Commit
·
2dac3ae
1
Parent(s):
5b5c00d
app
Browse files
app.py
CHANGED
|
@@ -36,18 +36,11 @@ def prepare_entities_for_highlight(text, results):
|
|
| 36 |
entity_text = text[
|
| 37 |
entity["start"] : entity["end"]
|
| 38 |
].strip() # Ensure we're working with the correct portion of the text
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
)
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
"text": entity_text,
|
| 45 |
-
"score": entity["score"],
|
| 46 |
-
"start": entity["start"],
|
| 47 |
-
"end": entity["end"],
|
| 48 |
-
"label": entity["entity"],
|
| 49 |
-
}
|
| 50 |
-
)
|
| 51 |
|
| 52 |
# Sort entities by their start position
|
| 53 |
entities = sorted(entities, key=lambda x: x["start"])
|
|
|
|
| 36 |
entity_text = text[
|
| 37 |
entity["start"] : entity["end"]
|
| 38 |
].strip() # Ensure we're working with the correct portion of the text
|
| 39 |
+
entity["text"] = entity_text
|
| 40 |
+
entity.pop("word")
|
| 41 |
+
print(f"Entity text: {entity}")
|
| 42 |
+
|
| 43 |
+
entities.append(entity)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
# Sort entities by their start position
|
| 46 |
entities = sorted(entities, key=lambda x: x["start"])
|