Spaces:
Sleeping
Sleeping
raul-padua
commited on
Commit
•
32b8285
1
Parent(s):
8124738
Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,7 @@ def merge_tokens(tokens):
|
|
7 |
merged_tokens = []
|
8 |
for token in tokens:
|
9 |
if merged_tokens and token['entity'].startswith('I-') and merged_tokens[-1]['entity'].endswith(token['entity'][2:]):
|
10 |
-
# If current token continues the entity of the last one, merge
|
11 |
last_token = merged_tokens[-1]
|
12 |
last_token['word'] += token['word'].replace('##', '')
|
13 |
last_token['end'] = token['end']
|
|
|
7 |
merged_tokens = []
|
8 |
for token in tokens:
|
9 |
if merged_tokens and token['entity'].startswith('I-') and merged_tokens[-1]['entity'].endswith(token['entity'][2:]):
|
10 |
+
# If current token continues the entity of the last one, merge the two tokens
|
11 |
last_token = merged_tokens[-1]
|
12 |
last_token['word'] += token['word'].replace('##', '')
|
13 |
last_token['end'] = token['end']
|