Javierss
commited on
Commit
·
5c1251d
1
Parent(s):
e180617
Rm external word files
Browse files- __pycache__/game_transformer.cpython-311.pyc +0 -0
- config/possible_words_part1.gz +0 -3
- config/possible_words_part2.gz +0 -3
- data/ranking.txt +8 -2
- game_transformer.py +11 -9
__pycache__/game_transformer.cpython-311.pyc
CHANGED
Binary files a/__pycache__/game_transformer.cpython-311.pyc and b/__pycache__/game_transformer.cpython-311.pyc differ
|
|
config/possible_words_part1.gz
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:3cdee4ac8ccd290a1e2b62762a88183132d82a4a20cca4c98cdd2aead3d2b8b0
|
3 |
-
size 3040618
|
|
|
|
|
|
|
|
config/possible_words_part2.gz
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:57d2bb64bff51827be8bf24d5689f3f49670fe556010d8cb3f2cc98875c155f2
|
3 |
-
size 3040822
|
|
|
|
|
|
|
|
data/ranking.txt
CHANGED
@@ -1,3 +1,9 @@
|
|
1 |
-
['#
|
2 |
---------------------------
|
3 |
-
['#1', '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
['#7', 'luz', 6.99]
|
2 |
---------------------------
|
3 |
+
['#1', 'amigo', 7.99]
|
4 |
+
['#2', 'persona', 7.9]
|
5 |
+
['#7', 'luz', 6.99]
|
6 |
+
['#6', 'amistad', 6.36]
|
7 |
+
['#4', 'familiar', 6.32]
|
8 |
+
['#5', 'hermano', 5.84]
|
9 |
+
['#3', 'familia', 4.77]
|
game_transformer.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
# %%
|
2 |
import json
|
3 |
-
import
|
4 |
import random
|
5 |
from datetime import datetime
|
6 |
import numpy as np
|
@@ -24,8 +24,6 @@ class Semantrix:
|
|
24 |
|
25 |
config_file_path = "config/lang.json"
|
26 |
secret_file_path = "config/secret.json"
|
27 |
-
possible_words_file_path_1 = "config/possible_words_part1.gz"
|
28 |
-
possible_words_file_path_2 = "config/possible_words_part2.gz"
|
29 |
data_path = "data/"
|
30 |
|
31 |
class DictWrapper:
|
@@ -55,12 +53,16 @@ class Semantrix:
|
|
55 |
file.write("---------------------------")
|
56 |
|
57 |
self.possible_words = []
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
|
|
|
|
|
|
|
|
64 |
|
65 |
def prepare_game(self, difficulty):
|
66 |
|
|
|
1 |
# %%
|
2 |
import json
|
3 |
+
import re
|
4 |
import random
|
5 |
from datetime import datetime
|
6 |
import numpy as np
|
|
|
24 |
|
25 |
config_file_path = "config/lang.json"
|
26 |
secret_file_path = "config/secret.json"
|
|
|
|
|
27 |
data_path = "data/"
|
28 |
|
29 |
class DictWrapper:
|
|
|
53 |
file.write("---------------------------")
|
54 |
|
55 |
self.possible_words = []
|
56 |
+
model_eng = KeyedVectors.load("config/w2v_models/eng_w2v_model", mmap="r")
|
57 |
+
self.possible_words.extend(list(model_eng.key_to_index.keys()))
|
58 |
+
model_esp = KeyedVectors.load("config/w2v_models/esp_w2v_model", mmap="r")
|
59 |
+
self.possible_words.extend(list(model_esp.key_to_index.keys()))
|
60 |
+
del model_eng, model_esp
|
61 |
+
|
62 |
+
pattern = re.compile(r"^[a-zA-Z0-9áéíóúÁÉÍÓÚñÑüÜ]+$")
|
63 |
+
filtered_words = [word for word in self.possible_words if pattern.match(word)]
|
64 |
+
unique_words = set(word.lower() for word in filtered_words)
|
65 |
+
self.possible_words = list(unique_words)
|
66 |
|
67 |
def prepare_game(self, difficulty):
|
68 |
|