Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -72,7 +72,10 @@ def generate_tagged_sentence(sentence, entity_tags):
|
|
| 72 |
for tag in entity_tags:
|
| 73 |
start = tag['start']
|
| 74 |
end = tag['end']
|
| 75 |
-
|
|
|
|
|
|
|
|
|
|
| 76 |
tag_name = f"[{tag['entity_group']}]"
|
| 77 |
|
| 78 |
tagged_tokens.append(f"{token} {tag_name}")
|
|
@@ -89,7 +92,10 @@ def replace_pp_with_pause(sentence, entity_tags):
|
|
| 89 |
for tag in entity_tags:
|
| 90 |
start = tag['start']
|
| 91 |
end = tag['end']
|
| 92 |
-
|
|
|
|
|
|
|
|
|
|
| 93 |
tag_name = f"[{tag['entity_group']}]"
|
| 94 |
|
| 95 |
if tag['entity_group'] == 'PP':
|
|
|
|
| 72 |
for tag in entity_tags:
|
| 73 |
start = tag['start']
|
| 74 |
end = tag['end']
|
| 75 |
+
if end<len(sentence)-1:
|
| 76 |
+
token = sentence[start:end] # Adjust for 0-based indexing
|
| 77 |
+
else:
|
| 78 |
+
token = sentence[start:end+1]
|
| 79 |
tag_name = f"[{tag['entity_group']}]"
|
| 80 |
|
| 81 |
tagged_tokens.append(f"{token} {tag_name}")
|
|
|
|
| 92 |
for tag in entity_tags:
|
| 93 |
start = tag['start']
|
| 94 |
end = tag['end']
|
| 95 |
+
if end<len(sentence)-1:
|
| 96 |
+
token = sentence[start:end] # Adjust for 0-based indexing
|
| 97 |
+
else:
|
| 98 |
+
token = sentence[start:end+1]
|
| 99 |
tag_name = f"[{tag['entity_group']}]"
|
| 100 |
|
| 101 |
if tag['entity_group'] == 'PP':
|