|
1 | | -# convertphones.py |
2 | 1 | # Takes list of words and finds appropriate phonemes |
3 | | -# If phoneme not found, an educated guess is made |
| 2 | +# If phoneme not found, an (un)educated guess is made |
4 | 3 |
|
5 | 4 | from Utilities import phonemes, util |
6 | 5 | import ast, re |
@@ -32,68 +31,9 @@ def phoneme_blocks_to_list(blocks): |
32 | 31 |
|
33 | 32 |
|
34 | 33 | def phoneme_scan(word): |
35 | | - # while re.search("[ट]", word): # Keep replacing letters with phonemes in brackets [] until there are no more letters |
36 | | - # Special patterns |
37 | | - # while re.search("[a-zA-Z.,;!?]", word): |
| 34 | + # Takes a word and returns a string of phonemes |
38 | 35 | while re.search("[अ-ॐ.,;!?]", word): |
39 | 36 |
|
40 | | - # word = replace_with_phoneme(word, r'iew', (phonemes.CONS_Y, phonemes.VOWEL_OO,phonemes.CONS_W)) |
41 | | - |
42 | | - # word = replace_with_phoneme(word, r'oo', (phonemes.VOWEL_OO,)) |
43 | | - # word = replace_with_phoneme(word, r'ou', (phonemes.VOWEL_OO,)) |
44 | | - # word = replace_with_phoneme(word, r'ea', (phonemes.VOWEL_II,)) |
45 | | - # word = replace_with_phoneme(word, r'ee', (phonemes.VOWEL_II,)) |
46 | | - |
47 | | - # word = replace_with_phoneme(word, r'gg', (phonemes.CONS_J,)) |
48 | | - # word = replace_with_phoneme(word, r'dd', (phonemes.CONS_D,)) |
49 | | - # word = replace_with_phoneme(word, r'ph', (phonemes.CONS_F,)) |
50 | | - # word = replace_with_phoneme(word, r'll', (phonemes.CONS_L,)) |
51 | | - # word = replace_with_phoneme(word, r'ss', (phonemes.CONS_S,)) |
52 | | - # word = replace_with_phoneme(word, r'nn', (phonemes.CONS_N,)) |
53 | | - # word = replace_with_phoneme(word, r'ch', (phonemes.CONS_CH,)) |
54 | | - # word = replace_with_phoneme(word, r'sh', (phonemes.CONS_SH,)) |
55 | | - # word = replace_with_phoneme(word, r'th', (phonemes.CONS_TH,)) |
56 | | - # word = replace_with_phoneme(word, r'ck', (phonemes.CONS_K,)) |
57 | | - |
58 | | -# # Default letters |
59 | | -# क |
60 | | -# ख |
61 | | -# ग |
62 | | -# घ |
63 | | -# ङ |
64 | | -# च |
65 | | -# छ |
66 | | -# ज |
67 | | -# झ |
68 | | -# ञ |
69 | | -# ट |
70 | | -# ठ |
71 | | -# ड |
72 | | -# ढ |
73 | | -# ण |
74 | | -# त |
75 | | -# थ |
76 | | -# द |
77 | | -# ध |
78 | | -# न |
79 | | -# ऩ |
80 | | -# प |
81 | | -# फ |
82 | | -# ब |
83 | | -# भ |
84 | | -# म |
85 | | -# य |
86 | | -# र |
87 | | -# ऱ |
88 | | -# ल |
89 | | -# ळ |
90 | | -# ऴ |
91 | | -# व |
92 | | -# श |
93 | | -# ष |
94 | | -# स |
95 | | -# ह |
96 | | - |
97 | 37 | word = replace_with_phoneme(word, "अ", (phonemes.VOWEL_U,)) |
98 | 38 | word = replace_with_phoneme(word, "आ", (phonemes.VOWEL_A,)) |
99 | 39 | word = replace_with_phoneme(word, "ा", (phonemes.VOWEL_A,)) |
@@ -164,11 +104,6 @@ def phoneme_scan(word): |
164 | 104 |
|
165 | 105 | word = replace_with_phoneme(word, "ज़", (phonemes.CONS_Z,)) |
166 | 106 |
|
167 | | - |
168 | | - # word = replace_with_phoneme(word, "q", (phonemes.CONS_K,)) |
169 | | - |
170 | | - # word = replace_with_phoneme(word, "w", (phonemes.CONS_W,)) |
171 | | - # word = replace_with_phoneme(word, "x", (phonemes.CONS_K, phonemes.CONS_S)) |
172 | 107 | word = replace_with_phoneme(word, ".", (phonemes.PUNC_PERIOD,)) |
173 | 108 | word = replace_with_phoneme(word, ",", (phonemes.PUNC_COMMA,)) |
174 | 109 | word = replace_with_phoneme(word, ";", (phonemes.PUNC_COMMA,)) |
|
0 commit comments