-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathletter_scheme.py
30 lines (21 loc) · 1.11 KB
/
letter_scheme.py
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
from get_pref import get_pref
english_1_letters = 'ABCDEFGHIJKLMNOPQRSTUVWX'
english_1_letters = english_1_letters + english_1_letters.lower()
european_1_letters = 'ABCDEFGHIJKLMNOPQRSTUVXZ'
european_1_letters = european_1_letters + european_1_letters.lower()
european_2_letters = 'ABCDQRSTEFGHIJKLMNOPUVXZ'
european_2_letters = european_2_letters + european_2_letters.lower()
english_2_letters = 'ABCDQRSTEFGHIJKLMNOPUVWX'
english_2_letters = english_2_letters + english_2_letters.lower()
for letters in [english_1_letters, european_1_letters, english_2_letters, english_2_letters]:
assert len(letters) == 6*4*2
letter_schemes = dict(
european_1={k: v for k, v in zip(european_1_letters, european_1_letters)},
english_1={k: v for k, v in zip(european_1_letters, english_1_letters)},
european_2={k: v for k, v in zip(european_1_letters, european_2_letters)},
english_2={k: v for k, v in zip(european_1_letters, english_2_letters)}
)
def letter_to_user_scheme(letter):
letter_scheme = get_pref('pref_s_letterscheme')
letter_scheme = letter_schemes[letter_scheme]
return letter_scheme[letter]