Commit
·
76f796b
1
Parent(s):
b0d1067
remove
Browse files- generic_ner.py +7 -0
generic_ner.py
CHANGED
|
@@ -476,6 +476,13 @@ def remove_included_entities(entities):
|
|
| 476 |
if entity["surface"] in other_entity["surface"]:
|
| 477 |
is_included = True
|
| 478 |
break
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 479 |
if not is_included:
|
| 480 |
final_entities.append(entity)
|
| 481 |
return final_entities
|
|
|
|
| 476 |
if entity["surface"] in other_entity["surface"]:
|
| 477 |
is_included = True
|
| 478 |
break
|
| 479 |
+
elif (
|
| 480 |
+
entity["type"].split(".")[0] in other_entity["type"].split(".")[0]
|
| 481 |
+
or other_entity["type"].split(".")[0]
|
| 482 |
+
in entity["type"].split(".")[0]
|
| 483 |
+
):
|
| 484 |
+
if entity["surface"] in other_entity["surface"]:
|
| 485 |
+
is_included = True
|
| 486 |
if not is_included:
|
| 487 |
final_entities.append(entity)
|
| 488 |
return final_entities
|