Emanuela Boros
commited on
Commit
•
516cd0a
1
Parent(s):
71e1eca
added lang
Browse files- generic_nel.py +5 -5
generic_nel.py
CHANGED
@@ -52,11 +52,11 @@ def get_wikipedia_page_props(input_str: str):
|
|
52 |
if "wikibase_item" in page_props:
|
53 |
return page_props["wikibase_item"]
|
54 |
else:
|
55 |
-
return qid
|
56 |
else:
|
57 |
-
return qid
|
58 |
except Exception as e:
|
59 |
-
return qid
|
60 |
|
61 |
|
62 |
def get_wikipedia_title(qid, language="en"):
|
@@ -159,11 +159,11 @@ class NelPipeline(Pipeline):
|
|
159 |
results = []
|
160 |
for idx, wikipedia_name in enumerate(wikipedia_predictions):
|
161 |
# Get QID
|
162 |
-
qid = get_wikipedia_page_props(wikipedia_name)
|
163 |
# print(f"{wikipedia_name} -- QID: {qid}")
|
164 |
|
165 |
# Get Wikipedia title and URL
|
166 |
-
wkpedia_pagename, url = get_wikipedia_title(qid)
|
167 |
results.append(
|
168 |
{
|
169 |
# "id": f"{lOffset}:{rOffset}:{enclosed_entity}:{NEL_MODEL}",
|
|
|
52 |
if "wikibase_item" in page_props:
|
53 |
return page_props["wikibase_item"]
|
54 |
else:
|
55 |
+
return qid, language
|
56 |
else:
|
57 |
+
return qid, language
|
58 |
except Exception as e:
|
59 |
+
return qid, language
|
60 |
|
61 |
|
62 |
def get_wikipedia_title(qid, language="en"):
|
|
|
159 |
results = []
|
160 |
for idx, wikipedia_name in enumerate(wikipedia_predictions):
|
161 |
# Get QID
|
162 |
+
qid, language = get_wikipedia_page_props(wikipedia_name)
|
163 |
# print(f"{wikipedia_name} -- QID: {qid}")
|
164 |
|
165 |
# Get Wikipedia title and URL
|
166 |
+
wkpedia_pagename, url = get_wikipedia_title(qid, language)
|
167 |
results.append(
|
168 |
{
|
169 |
# "id": f"{lOffset}:{rOffset}:{enclosed_entity}:{NEL_MODEL}",
|