Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -278,20 +278,24 @@ def entities_and_types(sentence):
|
|
| 278 |
|
| 279 |
return entity_dict
|
| 280 |
'''
|
|
|
|
|
|
|
|
|
|
| 281 |
def entities_and_types(sentence):
|
|
|
|
|
|
|
|
|
|
| 282 |
ner_output = extract(sentence)
|
| 283 |
print("RAW NER OUTPUT:", ner_output)
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
print("❌ DISTILL ERROR:", str(e))
|
| 294 |
-
return {}
|
| 295 |
|
| 296 |
entity_dict = {}
|
| 297 |
for name, entity_type, _, _ in entities:
|
|
|
|
| 278 |
|
| 279 |
return entity_dict
|
| 280 |
'''
|
| 281 |
+
def convert_ner_format(ner_output):
|
| 282 |
+
return [[item["token"], item["tags"]] for item in ner_output]
|
| 283 |
+
|
| 284 |
def entities_and_types(sentence):
|
| 285 |
+
print("\n=== NER DEBUG ===")
|
| 286 |
+
print("INPUT:", sentence)
|
| 287 |
+
|
| 288 |
ner_output = extract(sentence)
|
| 289 |
print("RAW NER OUTPUT:", ner_output)
|
| 290 |
+
|
| 291 |
+
# ✅ FIX HERE
|
| 292 |
+
converted = convert_ner_format(ner_output)
|
| 293 |
+
|
| 294 |
+
print("CONVERTED FORMAT:", converted)
|
| 295 |
+
|
| 296 |
+
entities = distill_entities(converted)
|
| 297 |
+
|
| 298 |
+
print("DISTILLED ENTITIES:", entities)
|
|
|
|
|
|
|
| 299 |
|
| 300 |
entity_dict = {}
|
| 301 |
for name, entity_type, _, _ in entities:
|