can I have a global dict in my code which is something like the following:
group = {
'vowel' : ['aa', 'ae', 'ah', 'ao', 'eh', 'er', 'ey', 'ih', 'iy', 'uh', 'uw', 'o'],
'consonant' : ['b', 'ch', 'd', 'dh', 'dx', 'f', 'g', 'hh', 'jh', 'k', 'l', 'm', 'n', 'ng', 'p', 'r', 's', 'sh', 't', 'th', 'v', 'w', 'y', 'z', 'zh']
}
It has a single key and multiple values. I need this dict because I have to make sure a phoneme is either a vowel or consonant to proceed further in the code. Later in the code I have to do something like,
if phoneme == vowel :
do this
else :
do that (for consonants)
Thank you.
It’s more effective to use sets (you can group them in dict if you want):