Commit
·
5b5c00d
1
Parent(s):
dd1b5ba
app
Browse files
app.py
CHANGED
|
@@ -24,6 +24,8 @@ def prepare_entities_for_highlight(text, results):
|
|
| 24 |
# Print debug info about tokenization
|
| 25 |
print(f"Original text: {text}")
|
| 26 |
|
|
|
|
|
|
|
| 27 |
for category, entity_list in results.items():
|
| 28 |
for entity in entity_list:
|
| 29 |
entity_span = (entity["start"], entity["end"])
|
|
@@ -39,9 +41,11 @@ def prepare_entities_for_highlight(text, results):
|
|
| 39 |
)
|
| 40 |
entities.append(
|
| 41 |
{
|
|
|
|
|
|
|
| 42 |
"start": entity["start"],
|
| 43 |
"end": entity["end"],
|
| 44 |
-
"label":
|
| 45 |
}
|
| 46 |
)
|
| 47 |
|
|
|
|
| 24 |
# Print debug info about tokenization
|
| 25 |
print(f"Original text: {text}")
|
| 26 |
|
| 27 |
+
# it should look like:
|
| 28 |
+
# [{'entity': 'org.ent.pressagency.Reuters', 'score': np.float32(98.47), 'index': 78, 'word': 'Reuters', 'start': 440, 'end': 447}]
|
| 29 |
for category, entity_list in results.items():
|
| 30 |
for entity in entity_list:
|
| 31 |
entity_span = (entity["start"], entity["end"])
|
|
|
|
| 41 |
)
|
| 42 |
entities.append(
|
| 43 |
{
|
| 44 |
+
"text": entity_text,
|
| 45 |
+
"score": entity["score"],
|
| 46 |
"start": entity["start"],
|
| 47 |
"end": entity["end"],
|
| 48 |
+
"label": entity["entity"],
|
| 49 |
}
|
| 50 |
)
|
| 51 |
|