How to use the pysle.pronunciationtools.findBestSyllabification 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('-' * 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
# and filling in the gaps before inside and after each string
# so that those common characters appear in the same positions
print('-' * 50)
phoneListA = ['a', 'b', 'c', 'd', 'e', 'f']
phoneListB = ['l', 'a', 'z', 'd', 'u']
alignedPhoneListA, alignedPhoneListB = pronunciationtools.alignPronunciations(
    phoneListA, phoneListB)
print(alignedPhoneListA)
print(alignedPhoneListB)