Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'truncate', False)
wordEntryList = wordTier.entryList
# Do the naive alignment
for startT, stopT, label in utteranceTier.entryList:
wordList = label.split()
# Get the list of phones in each word
superPhoneList = []
numPhones = 0
i = 0
while i < len(wordList):
word = wordList[i]
try:
firstSyllableList = isleDict.lookup(word)[0][0][0]
except isletool.WordNotInISLE:
wordList.pop(i)
continue
phoneList = [phone for syllable in firstSyllableList
for phone in syllable]
superPhoneList.append(phoneList)
numPhones += len(phoneList)
i += 1
# Get the naive alignment for words, if alignment doesn't
# already exist for words
subWordEntryList = []
subPhoneEntryList = []
if wordTier is not None:
subWordEntryList = wordTier.crop(startT, stopT,
"truncated", False).entryList
def simplifyPronunciation(phoneList):
'''
Simplifies pronunciation
Removes diacritics and unifies vowels and rhotics
'''
retList = []
for phone in phoneList:
# Remove diacritics
for diacritic in isletool.diacriticList:
phone = phone.replace(diacritic, u'')
# Unify rhotics
if 'r' in phone:
phone = 'r'
phone = phone.lower()
# Unify vowels
if isletool.isVowel(phone):
phone = u'V'
# Only represent the string by its first letter
try:
phone = phone[0]
except IndexError: