-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathalgorithm.py
More file actions
80 lines (68 loc) · 1.96 KB
/
Copy pathalgorithm.py
File metadata and controls
80 lines (68 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import itertools
dictionary = {
"א": ["", "a", "'", "o", "i"],
"ב": ["v", "b"],
"ג": ["g", "j", "zh"],
"ד": ["d"],
"ה": ["", "h", "eh", "ah", "a", "e", "ay", "ei", "ai", "ey"],
"ו": ["v", "w", "oh", "o", "wu", "oo", "u", "ou", "oe", "ue"],
"ז": ["z", "s"],
"ח": ["ch", "h", "kh", "ach", "akh"],
"ט": ["t", "th"],
"י": ["y", "i", "", "e"],
"כ": ["ch", "h", "k", "c", "kh", "ck"],
"ל": ["l"],
"מ": ["m"],
"נ": ["n"],
"ס": ["s"],
"ע": ["", "a", "i", "ee"],
"פ": ["f", "ph", "p"],
"צ": ["ts", "tz", "s", "z", "izz", "tez"],
"ק": ["k", "c", "q"],
"ר": ["r"],
"ש": ["s", "sh", "ch", "sch"],
"ת": ["t", "th"],
"יי": ["ai", "ay", "ey", "ei"],
"יו": ["av", "ev"],
"וו": ["w", "wu", "wa", "wo", "v", "ve", "va", "vu"],
"": ["a", "i", "e", "o", "h", "u", "y"]
}
def last_letter(user_entry):
letter_opts = []
for letter in user_entry:
keys = [key for key, value in dictionary.items() if letter in value]
letter_opts.append(keys)
print(letter_opts)
if letter_opts[len(user_entry)-1] == ['מ']:
print('ם')
elif letter_opts[len(user_entry)-1] == ['פ']:
print('ף')
elif letter_opts[len(user_entry)-1] == ['כ']:
print('ך')
elif letter_opts[len(user_entry)-1] == ['צ']:
print('ץ')
elif letter_opts[len(user_entry)-1] == ['נ']:
print('ן')
else:
print(-1)
# last_letter(['sh', 'a', 'l', 'o', 'm'])
# last_letter(['d', 'a', 'f'])
def heb_keys(user_entry):
for letter in user_entry:
keys = [key for key, value in dictionary.items() if letter in value]
return keys
heb_keys(['d', 'a', 'f'])
# heb_keys(['h', 'ai', 'm'])
keys = [['ד'], ['א', 'ה', 'ע', ''], ['ף']]
def word_combos(keys):
words = list(itertools.product(*keys))
for word in words:
word = ''.join(word)
print(word)
word_combos(keys)
'''
דאף
דהף
דעף
דף
'''