Update generic_ner.py
Browse files- generic_ner.py +9 -2
generic_ner.py
CHANGED
|
@@ -87,10 +87,17 @@ def get_entities(tokens, tags, confidences, text):
|
|
| 87 |
for indices in find_entity_indices(text, original_string):
|
| 88 |
entity_start_position = indices[0]
|
| 89 |
entity_end_position = indices[1]
|
| 90 |
-
if
|
|
|
|
|
|
|
|
|
|
| 91 |
continue
|
| 92 |
else:
|
| 93 |
-
already_done.append(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
entities.append(
|
| 95 |
{
|
| 96 |
"entity": original_label,
|
|
|
|
| 87 |
for indices in find_entity_indices(text, original_string):
|
| 88 |
entity_start_position = indices[0]
|
| 89 |
entity_end_position = indices[1]
|
| 90 |
+
if (
|
| 91 |
+
"_".join([original_label, original_string, str(entity_start_position)])
|
| 92 |
+
in already_done
|
| 93 |
+
):
|
| 94 |
continue
|
| 95 |
else:
|
| 96 |
+
already_done.append(
|
| 97 |
+
"_".join(
|
| 98 |
+
[original_label, original_string, str(entity_start_position)]
|
| 99 |
+
)
|
| 100 |
+
)
|
| 101 |
entities.append(
|
| 102 |
{
|
| 103 |
"entity": original_label,
|