From 393182500e956b3c80c06ec80c40d6330deaf6b1 Mon Sep 17 00:00:00 2001 From: timmahrt Date: Tue, 28 Jul 2015 14:30:20 -0500 Subject: [PATCH] REFACTOR: Syncronized changes with the praatio library Optional textgrid functionality requires praatio 2.1.0 or greater. --- pysle/praattools.py | 8 ++++---- test/syllabifyTextgrid.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pysle/praattools.py b/pysle/praattools.py index 6a246f9..70a9913 100644 --- a/pysle/praattools.py +++ b/pysle/praattools.py @@ -11,7 +11,7 @@ class OptionalFeatureError(ImportError): return "ERROR: You must have praatio installed to use pysle.praatTools" try: - import praatio + from praatio import tgio except ImportError: raise OptionalFeatureError() @@ -97,10 +97,10 @@ def syllabifyTextgrid(isleDict, tg, wordTierName, phoneTierName, tonicEntryList.append((syllableStart, syllableEnd, tonicLabel)) # Create a textgrid with the two syllable-level tiers - syllableTier = praatio.IntervalTier("syllable", syllableEntryList) - tonicTier = praatio.IntervalTier('tonic', tonicEntryList) + syllableTier = tgio.IntervalTier("syllable", syllableEntryList) + tonicTier = tgio.IntervalTier('tonic', tonicEntryList) - syllableTG = praatio.Textgrid() + syllableTG = tgio.Textgrid() syllableTG.addTier(syllableTier) syllableTG.addTier(tonicTier) diff --git a/test/syllabifyTextgrid.py b/test/syllabifyTextgrid.py index 3793774..bfac6fb 100644 --- a/test/syllabifyTextgrid.py +++ b/test/syllabifyTextgrid.py @@ -12,14 +12,14 @@ This snippet shows you how to use this function. from os.path import join -import praatio +from praatio import tgio from pysle import isletool from pysle import praattools path = join('.', 'files') path = "/Users/tmahrt/Dropbox/workspace/pysle/test/files" -tg = praatio.openTextGrid(join(path, "pumpkins.TextGrid")) +tg = tgio.openTextGrid(join(path, "pumpkins.TextGrid")) # Needs the full path to the file islevPath = '/Users/tmahrt/Dropbox/workspace/pysle/test/islev2.txt'