Update generic_ner.py
Browse files- generic_ner.py +2 -1
generic_ner.py
CHANGED
@@ -106,11 +106,12 @@ def get_entities(tokens, tags, confidences, text):
|
|
106 |
entities.append(
|
107 |
{
|
108 |
"entity": original_label,
|
109 |
-
"score":
|
110 |
"index": idx,
|
111 |
"word": original_string,
|
112 |
"start": entity_start_position,
|
113 |
"end": entity_end_position,
|
|
|
114 |
}
|
115 |
)
|
116 |
print(text[entity_start_position:entity_end_position], '-------', original_string)
|
|
|
106 |
entities.append(
|
107 |
{
|
108 |
"entity": original_label,
|
109 |
+
"score": np.average(confidences[idx : idx + len(subtree)]),
|
110 |
"index": idx,
|
111 |
"word": original_string,
|
112 |
"start": entity_start_position,
|
113 |
"end": entity_end_position,
|
114 |
+
"text": text
|
115 |
}
|
116 |
)
|
117 |
print(text[entity_start_position:entity_end_position], '-------', original_string)
|