How to use the pysle.pronunciationtools.findClosestPronunciation function in pysle

To help you get started, we’ve selected a few pysle examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github timmahrt / pysle / examples / pronunciationtools_examples.py View on Github external
print(anotherPhoneList)
print(stressedSyllableIndexList)  # We can see the first syllable was elided
print(stressedPhoneIndexList)
print(flattenedStressIndexList)
print(syllableList)
print(syllabification)


# In the second example, we have a pronunciation and find the closest dictionary
# pronunciation to it
print('-' * 50)

searchWord = 'labyrinth'
phoneList = ['l', 'a', 'b', 'e', 'r', 'e', 'n', 'th']
isleWordList = isleDict.lookup(searchWord)
retList = pronunciationtools.findClosestPronunciation(
    isleDict, searchWord, phoneList)
print(searchWord)
print(phoneList)
print(isleWordList)
print(retList)

print('===========================')
searchWord = 'labyrinth'
phoneList = ['l', 'a', 'b', 'e', 'r', 'e', 'n', 'th']
x = pronunciationtools.findBestSyllabification(
    isleDict, searchWord, anotherPhoneList)
print(x)


# In the third example, two pronunciations are aligned.
# This is done by finding the longest common sequence inside of them