Commit
·
eb52b2b
1
Parent(s):
0a9c7b1
add comp back
Browse files- generic_ner.py +6 -1
generic_ner.py
CHANGED
|
@@ -269,6 +269,8 @@ def extract_name_from_text(text, partial_name):
|
|
| 269 |
text_lower = text.lower()
|
| 270 |
partial_name_lower = partial_name.lower()
|
| 271 |
|
|
|
|
|
|
|
| 272 |
# Find the position of the partial name in the text
|
| 273 |
name_start_idx = text_lower.find(partial_name_lower)
|
| 274 |
|
|
@@ -293,11 +295,14 @@ def extract_name_from_text(text, partial_name):
|
|
| 293 |
full_name.insert(0, words[j])
|
| 294 |
j -= 1
|
| 295 |
|
| 296 |
-
return
|
|
|
|
|
|
|
| 297 |
|
| 298 |
# If not found, return the original text (as a fallback)
|
| 299 |
return text.strip()
|
| 300 |
|
|
|
|
| 301 |
def repair_names_in_entities(entities):
|
| 302 |
"""
|
| 303 |
This function repairs the names in the entities by extracting the full name
|
|
|
|
| 269 |
text_lower = text.lower()
|
| 270 |
partial_name_lower = partial_name.lower()
|
| 271 |
|
| 272 |
+
print("text", text, "partial_name", partial_name)
|
| 273 |
+
|
| 274 |
# Find the position of the partial name in the text
|
| 275 |
name_start_idx = text_lower.find(partial_name_lower)
|
| 276 |
|
|
|
|
| 295 |
full_name.insert(0, words[j])
|
| 296 |
j -= 1
|
| 297 |
|
| 298 |
+
return " ".join(
|
| 299 |
+
full_name
|
| 300 |
+
).strip() # Join the words to form the full name
|
| 301 |
|
| 302 |
# If not found, return the original text (as a fallback)
|
| 303 |
return text.strip()
|
| 304 |
|
| 305 |
+
|
| 306 |
def repair_names_in_entities(entities):
|
| 307 |
"""
|
| 308 |
This function repairs the names in the entities by extracting the full name
|