Emanuela Boros
commited on
Commit
•
3cf0565
1
Parent(s):
6d7265e
add lang
Browse files- generic_nel.py +1 -14
generic_nel.py
CHANGED
@@ -145,21 +145,9 @@ class NelPipeline(Pipeline):
|
|
145 |
:return:
|
146 |
"""
|
147 |
|
148 |
-
# {
|
149 |
-
# "surface": sentences[i].split("[START]")[1].split("[END]")[0],
|
150 |
-
# "lOffset": lOffset,
|
151 |
-
# "rOffset": rOffset,
|
152 |
-
# "type": "UNK",
|
153 |
-
# "id": f"{lOffset}:{rOffset}:{surface}:{NEL_MODEL}",
|
154 |
-
# "wkd_id": get_wikipedia_page_props(wikipedia_titles[i * 2]),
|
155 |
-
# "wkpedia_pagename": wikipedia_titles[
|
156 |
-
# i * 2
|
157 |
-
# ], # This can be improved with a real API call to get the QID
|
158 |
-
# "confidence_nel": np.round(percentages[i], 2),
|
159 |
-
# }
|
160 |
wikipedia_prediction, enclosed_entity, lOffset, rOffset, percentage = outputs
|
161 |
qid, language = get_wikipedia_page_props(wikipedia_prediction)
|
162 |
-
title, url = get_wikipedia_title(qid, language=
|
163 |
|
164 |
percentage = round(percentage, 2)
|
165 |
|
@@ -176,5 +164,4 @@ class NelPipeline(Pipeline):
|
|
176 |
"rOffset": rOffset,
|
177 |
}
|
178 |
]
|
179 |
-
# print(results)
|
180 |
return results
|
|
|
145 |
:return:
|
146 |
"""
|
147 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
wikipedia_prediction, enclosed_entity, lOffset, rOffset, percentage = outputs
|
149 |
qid, language = get_wikipedia_page_props(wikipedia_prediction)
|
150 |
+
title, url = get_wikipedia_title(qid, language=language)
|
151 |
|
152 |
percentage = round(percentage, 2)
|
153 |
|
|
|
164 |
"rOffset": rOffset,
|
165 |
}
|
166 |
]
|
|
|
167 |
return results
|