Javierss commited on
Commit
5c1251d
·
1 Parent(s): e180617

Rm external word files

Browse files
__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
- ['#1', 'a', 6.34]
2
  ---------------------------
3
- ['#1', 'a', 6.34]
 
 
 
 
 
 
 
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 gzip
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
- with gzip.open(self.possible_words_file_path_1, "rt", encoding="utf-8") as f1:
59
- self.possible_words.extend(f1.read().splitlines())
60
-
61
- # Load the second part
62
- with gzip.open(self.possible_words_file_path_2, "rt", encoding="utf-8") as f2:
63
- self.possible_words.extend(f2.read().splitlines())
 
 
 
 
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