Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -244,10 +244,12 @@ def classify_tokens(text: str, use_canned=False):
|
|
| 244 |
)
|
| 245 |
|
| 246 |
# tagged spans
|
| 247 |
-
results_spans = pipe(text, aggregation_strategy="simple")
|
|
|
|
| 248 |
|
| 249 |
# per-token + probabilities
|
| 250 |
-
results_tokens = pipe(text, aggregation_strategy="none", ignore_labels=[])
|
|
|
|
| 251 |
print(results_tokens)
|
| 252 |
else: # canned example to test the output display
|
| 253 |
text = "fox in socks"
|
|
|
|
| 244 |
)
|
| 245 |
|
| 246 |
# tagged spans
|
| 247 |
+
results_spans = pipe(text, aggregation_strategy="simple")
|
| 248 |
+
results_spans.sort(key=lambda x: x["start"])
|
| 249 |
|
| 250 |
# per-token + probabilities
|
| 251 |
+
results_tokens = pipe(text, aggregation_strategy="none", ignore_labels=[])
|
| 252 |
+
results_tokens.sort(key=lambda x: x["start"])
|
| 253 |
print(results_tokens)
|
| 254 |
else: # canned example to test the output display
|
| 255 |
text = "fox in socks"
|