Commit
·
6e667ae
1
Parent(s):
eb52b2b
add comp back
Browse files- generic_ner.py +2 -4
generic_ner.py
CHANGED
|
@@ -266,13 +266,11 @@ def extract_name_from_text(text, partial_name):
|
|
| 266 |
This function starts from the partial name, checks backward for the last capitalized word,
|
| 267 |
and includes all words from that point up to the partial name, including any lowercase words in between.
|
| 268 |
"""
|
| 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 =
|
| 276 |
|
| 277 |
if name_start_idx != -1:
|
| 278 |
# Split the text into words
|
|
@@ -280,7 +278,7 @@ def extract_name_from_text(text, partial_name):
|
|
| 280 |
|
| 281 |
# Find the position of the partial name in the word list
|
| 282 |
for i, word in enumerate(words):
|
| 283 |
-
if
|
| 284 |
# Initialize full name with the partial name
|
| 285 |
full_name = [word]
|
| 286 |
|
|
|
|
| 266 |
This function starts from the partial name, checks backward for the last capitalized word,
|
| 267 |
and includes all words from that point up to the partial name, including any lowercase words in between.
|
| 268 |
"""
|
|
|
|
|
|
|
| 269 |
|
| 270 |
print("text", text, "partial_name", partial_name)
|
| 271 |
|
| 272 |
# Find the position of the partial name in the text
|
| 273 |
+
name_start_idx = text.find(partial_name)
|
| 274 |
|
| 275 |
if name_start_idx != -1:
|
| 276 |
# Split the text into words
|
|
|
|
| 278 |
|
| 279 |
# Find the position of the partial name in the word list
|
| 280 |
for i, word in enumerate(words):
|
| 281 |
+
if partial_name in word:
|
| 282 |
# Initialize full name with the partial name
|
| 283 |
full_name = [word]
|
| 284 |
|