Spaces:
Sleeping
Sleeping
Update game1.py
Browse files
game1.py
CHANGED
|
@@ -294,9 +294,27 @@ def interpre1(lang_selected, num_selected):
|
|
| 294 |
else:
|
| 295 |
is_subword.append(False)
|
| 296 |
print(is_subword)
|
| 297 |
-
print(interpretation)
|
| 298 |
|
| 299 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 300 |
# pos = []
|
| 301 |
# neg = []
|
| 302 |
# res = []
|
|
|
|
| 294 |
else:
|
| 295 |
is_subword.append(False)
|
| 296 |
print(is_subword)
|
|
|
|
| 297 |
|
| 298 |
+
interpretation_combined = []
|
| 299 |
+
|
| 300 |
+
index_tmp = 0
|
| 301 |
+
while index_tmp < len(interpretation) - 1:
|
| 302 |
+
if not is_subword[index_tmp+1]:
|
| 303 |
+
interpretation_combined.append(interpretation[i])
|
| 304 |
+
index += 1
|
| 305 |
+
else:
|
| 306 |
+
text_combined = interpretation[index_tmp][0]
|
| 307 |
+
score_combinded = interpretation[index_tmp][1]
|
| 308 |
+
length = 1
|
| 309 |
+
while is_subword[index_tmp+length]:
|
| 310 |
+
text_combined += interpretation[index_tmp+length][0]
|
| 311 |
+
score_combinded += interpretation[index_tmp+length][1]
|
| 312 |
+
length += 1
|
| 313 |
+
interpretation_combined.append((text_combined, score_combinded/length))
|
| 314 |
+
index += length
|
| 315 |
+
|
| 316 |
+
print(interpretation_combined)
|
| 317 |
+
res = {"original": text['text'], "interpretation": interpretation_combined}
|
| 318 |
# pos = []
|
| 319 |
# neg = []
|
| 320 |
# res = []
|