Spaces:
Runtime error
Runtime error
Update ✨Entity Linking Application✨.py
Browse files
✨Entity Linking Application✨.py
CHANGED
|
@@ -63,7 +63,7 @@ async def combination_method(name, session):
|
|
| 63 |
for i in x:
|
| 64 |
new_word = (i[0] + " " + i[1])
|
| 65 |
url = f"{new_word} site:en.wikipedia.org inurl:/wiki/ -inurl:? -inurl:Category: -inurl:Help: -inurl:Special: -inurl:File:"
|
| 66 |
-
s = search(url, num_results = 12, lang="en", region="us", sleep_interval=
|
| 67 |
for i in s:
|
| 68 |
data.add(i.split("/")[-1])
|
| 69 |
return data
|
|
@@ -74,7 +74,7 @@ async def single_method(name, session):
|
|
| 74 |
new_name = name.replace("-", " ").replace("/", " ").split()
|
| 75 |
for i in new_name:
|
| 76 |
url = f"{i} site:en.wikipedia.org inurl:/wiki/ -inurl:? -inurl:Category: -inurl:Help: -inurl:Special: -inurl:File:"
|
| 77 |
-
s = search(url, num_results = 12, lang="en", region="us", sleep_interval=
|
| 78 |
for i in s:
|
| 79 |
data.add(i.split("/")[-1])
|
| 80 |
return data
|
|
@@ -86,7 +86,7 @@ async def mains(name, single, combi):
|
|
| 86 |
|
| 87 |
async with aiohttp.ClientSession() as session:
|
| 88 |
url = f"{name} site:en.wikipedia.org inurl:/wiki/ -inurl:? -inurl:Category: -inurl:Help: -inurl:Special: -inurl:File:"
|
| 89 |
-
s = search(url, num_results = 30, lang="en", region="us", sleep_interval=
|
| 90 |
for i in s:
|
| 91 |
data.add(i.split("/")[-1])
|
| 92 |
|
|
@@ -422,7 +422,7 @@ def main_cli():
|
|
| 422 |
number = 0
|
| 423 |
for i,j,o in zip(list_with_full_names,list_with_contexts,list_with_names_to_show):
|
| 424 |
number += 1
|
| 425 |
-
with st.spinner(f"Applying Candidate Selection module... (4/5) [{number}/{len(list_with_full_names)}]"):
|
| 426 |
with open(f"/home/user/app/info_extraction/{i}.json", "r") as f:
|
| 427 |
json_file = json.load(f)
|
| 428 |
lista = []
|
|
@@ -448,7 +448,6 @@ def main_cli():
|
|
| 448 |
desc_label = model.similarity(desc_dataset_emb, v[1][0])
|
| 449 |
emb_mean = np.mean([cossim_label, desc_label])
|
| 450 |
lista_1.append({k: emb_mean})
|
| 451 |
-
print(k)
|
| 452 |
|
| 453 |
sorted_data = sorted(lista_1, key=lambda x: list(x.values())[0], reverse=True)
|
| 454 |
st.write(f"✅ Applined Candidate Selection module (4/5) [{number}/{len(list_with_full_names)}]")
|
|
|
|
| 63 |
for i in x:
|
| 64 |
new_word = (i[0] + " " + i[1])
|
| 65 |
url = f"{new_word} site:en.wikipedia.org inurl:/wiki/ -inurl:? -inurl:Category: -inurl:Help: -inurl:Special: -inurl:File:"
|
| 66 |
+
s = search(url, num_results = 12, lang="en", region="us", sleep_interval=2)
|
| 67 |
for i in s:
|
| 68 |
data.add(i.split("/")[-1])
|
| 69 |
return data
|
|
|
|
| 74 |
new_name = name.replace("-", " ").replace("/", " ").split()
|
| 75 |
for i in new_name:
|
| 76 |
url = f"{i} site:en.wikipedia.org inurl:/wiki/ -inurl:? -inurl:Category: -inurl:Help: -inurl:Special: -inurl:File:"
|
| 77 |
+
s = search(url, num_results = 12, lang="en", region="us", sleep_interval=2)
|
| 78 |
for i in s:
|
| 79 |
data.add(i.split("/")[-1])
|
| 80 |
return data
|
|
|
|
| 86 |
|
| 87 |
async with aiohttp.ClientSession() as session:
|
| 88 |
url = f"{name} site:en.wikipedia.org inurl:/wiki/ -inurl:? -inurl:Category: -inurl:Help: -inurl:Special: -inurl:File:"
|
| 89 |
+
s = search(url, num_results = 30, lang="en", region="us", sleep_interval=2)
|
| 90 |
for i in s:
|
| 91 |
data.add(i.split("/")[-1])
|
| 92 |
|
|
|
|
| 422 |
number = 0
|
| 423 |
for i,j,o in zip(list_with_full_names,list_with_contexts,list_with_names_to_show):
|
| 424 |
number += 1
|
| 425 |
+
with st.spinner(f"Applying Candidate Selection module... (4/5) [{number}/{len(list_with_full_names)}] (This may take a while)"):
|
| 426 |
with open(f"/home/user/app/info_extraction/{i}.json", "r") as f:
|
| 427 |
json_file = json.load(f)
|
| 428 |
lista = []
|
|
|
|
| 448 |
desc_label = model.similarity(desc_dataset_emb, v[1][0])
|
| 449 |
emb_mean = np.mean([cossim_label, desc_label])
|
| 450 |
lista_1.append({k: emb_mean})
|
|
|
|
| 451 |
|
| 452 |
sorted_data = sorted(lista_1, key=lambda x: list(x.values())[0], reverse=True)
|
| 453 |
st.write(f"✅ Applined Candidate Selection module (4/5) [{number}/{len(list_with_full_names)}]")
|