ironbar commited on
Commit
e37d1d1
1 Parent(s): 0f7d64d

better syllabes

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py CHANGED
@@ -12,9 +12,26 @@ def download_data():
12
  len_to_words[len(word)] = [word]
13
  else:
14
  len_to_words[len(word)].append(word)
 
15
  return len_to_words
16
 
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  def get_random_word(n_letters, forbidden_letters='', required_letters=''):
19
  random.shuffle(LEN_TO_WORDS[n_letters])
20
  for word in LEN_TO_WORDS[n_letters]:
 
12
  len_to_words[len(word)] = [word]
13
  else:
14
  len_to_words[len(word)].append(word)
15
+ len_to_words[2] = get_syllabes()
16
  return len_to_words
17
 
18
 
19
+ def get_syllabes():
20
+ syllabes = set()
21
+ vowels = 'aeiou'
22
+ consonants = 'bcdfghjklmnpqrstvwxyz'
23
+ for consonant in consonants:
24
+ for vowel in vowels:
25
+ if consonant in 'gq' and vowel in 'ei':
26
+ syllabes.add(consonant + 'u' + vowel)
27
+ else:
28
+ syllabes.add(consonant + vowel)
29
+ remove = ['qu', 'qa', 'qi', 'qo', 'qu']
30
+ syllabes = sorted(list(syllabes.difference(remove)))
31
+ print(syllabes)
32
+ return syllabes
33
+
34
+
35
  def get_random_word(n_letters, forbidden_letters='', required_letters=''):
36
  random.shuffle(LEN_TO_WORDS[n_letters])
37
  for word in LEN_TO_WORDS[n_letters]: