How to use the pysle.praattools.naiveWordAlignment 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 / alignment_example.py View on Github external
inputFN = join(root, "pumpkins_with_syllables.TextGrid")
outputFN = join(root, "pumpkins_with_naive_alignment.TextGrid")

utteranceTierName = "utterance"
wordTierName = "word"
phoneListTierName = "phoneList"
phoneTierName = "phone"

tg = tgio.openTextgrid(inputFN)

for tierName in tg.tierNameList[:]:
    if tierName == utteranceTierName:
        continue
    tg.removeTier(tierName)
tg = praattools.naiveWordAlignment(tg, utteranceTierName, wordTierName,
                                   isleDict, phoneListTierName)
tg = praattools.naivePhoneAlignment(tg, wordTierName, phoneTierName,
                                    isleDict)
tg.save(outputFN)