Spaces:
Running
Running
Update game1.py
Browse files
game1.py
CHANGED
@@ -284,10 +284,15 @@ def interpre1(lang_selected, num_selected):
|
|
284 |
text = eval(content[int(num_selected*2)])
|
285 |
interpretation = eval(content[int(num_selected*2+1)])
|
286 |
|
287 |
-
encodings = tokenizer(text['text']
|
288 |
-
|
289 |
print(encodings['offset_mapping'])
|
290 |
-
is_subword =
|
|
|
|
|
|
|
|
|
|
|
291 |
print(is_subword)
|
292 |
print(interpretation)
|
293 |
|
|
|
284 |
text = eval(content[int(num_selected*2)])
|
285 |
interpretation = eval(content[int(num_selected*2+1)])
|
286 |
|
287 |
+
encodings = tokenizer(text['text'], return_offsets_mapping=True)
|
288 |
+
|
289 |
print(encodings['offset_mapping'])
|
290 |
+
is_subword = [False, False]
|
291 |
+
for i in range(2, len(encodings['offset_mapping'])):
|
292 |
+
if encodings['offset_mapping'][i][0] == encodings['offset_mapping'][i-1][1]:
|
293 |
+
is_subword.append(True)
|
294 |
+
else:
|
295 |
+
is_subword.append(False)
|
296 |
print(is_subword)
|
297 |
print(interpretation)
|
298 |
|