Spaces:
Running
Running
johnpaulbin
commited on
Commit
·
fff5a8f
1
Parent(s):
2c6b6c7
Update app.py
Browse files
app.py
CHANGED
@@ -45,10 +45,10 @@ spanish_words = set()
|
|
45 |
for pair in json_data:
|
46 |
if "english" in pair:
|
47 |
# Extract words from the English sentence and filter out numbers
|
48 |
-
english_words.update(filter(is_word, re.findall(r'\b\w+\b', pair
|
49 |
if "spanish" in pair:
|
50 |
# Extract words from the Spanish sentence and filter out numbers
|
51 |
-
spanish_words.update(filter(is_word, re.findall(r'\b\w+\b', pair
|
52 |
|
53 |
def get_distractors(target_word, all_words, num_distractors=3):
|
54 |
"""
|
|
|
45 |
for pair in json_data:
|
46 |
if "english" in pair:
|
47 |
# Extract words from the English sentence and filter out numbers
|
48 |
+
english_words.update(filter(is_word, re.findall(r'\b\w+\b', pair.get("english", ""))))
|
49 |
if "spanish" in pair:
|
50 |
# Extract words from the Spanish sentence and filter out numbers
|
51 |
+
spanish_words.update(filter(is_word, re.findall(r'\b\w+\b', pair.get("spanish", ""))))
|
52 |
|
53 |
def get_distractors(target_word, all_words, num_distractors=3):
|
54 |
"""
|