How to use the pysle.praattools 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 / pyAcoustics / pyacoustics / textgrids / syllabify_textgrids.py View on Github external
def syllabifyTextgrids(tgPath, islePath):

    isleDict = isletool.LexicalTool(islePath)

    outputPath = join(tgPath, "syllabifiedTGs")
    utils.makeDir(outputPath)
    skipLabelList = ["", "xx", "", "{B_TRANS}", '{E_TRANS}']

    for fn in utils.findFiles(tgPath, filterExt=".TextGrid"):

        if os.path.exists(join(outputPath, fn)):
            continue

        tg = tgio.openTextgrid(join(tgPath, fn))
        
        syllableTG = praattools.syllabifyTextgrid(isleDict, tg, "words",
                                                  "phones",
                                                  skipLabelList=skipLabelList)
        
        outputTG = tgio.Textgrid()
        outputTG.addTier(tg.tierDict["words"])
        outputTG.addTier(tg.tierDict["phones"])
#         outputTG.addTier(syllableTG.tierDict["syllable"])
        outputTG.addTier(syllableTG.tierDict["tonic"])
        
        outputTG.save(join(outputPath, fn))
github timmahrt / pysle / examples / syllabify_textgrid.py View on Github external
praatio library.
'''

from os.path import join

from praatio import tgio
from pysle import isletool
from pysle import praattools

root = join('.', 'files')
isleDict = isletool.LexicalTool(join(root, "ISLEdict_sample.txt"))

tg = tgio.openTextgrid(join(root, "pumpkins.TextGrid"))

# Get the syllabification tiers and add it to the textgrid
syllableTG = praattools.syllabifyTextgrid(isleDict, tg, "word", "phone",
                                          skipLabelList=["", ])
tg.addTier(syllableTG.tierDict["syllable"])
tg.addTier(syllableTG.tierDict["tonicSyllable"])
tg.addTier(syllableTG.tierDict["tonicVowel"])

tg.save(join(root, "pumpkins_with_syllables.TextGrid"))