mirror of
https://github.com/wassname/pysle.git
synced 2026-06-27 16:10:05 +08:00
REFACTOR: Syncronized changes with the praatio library
Optional textgrid functionality requires praatio 2.1.0 or greater.
This commit is contained in:
+4
-4
@@ -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)
|
||||
|
||||
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user