INITIAL COMMIT: pysle - python interface to ISLEX dictionary

Code tested over a decent corpus.  Features:

- look up phone and syllable info for the
  canonical pronunciation of a word

- map an actual pronunciation to a dictionary
  pronunciation (can be used to automatically find
  speech errors)

- automatically syllabify a textgrid containing words
  and phones (e.g. force-aligned text)
This commit is contained in:
Tim Mahrt
2014-10-23 15:13:07 -05:00
commit 5d598b1b88
12 changed files with 903 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
'''
Created on Oct 22, 2014
@author: tmahrt
Basic examples of common usage.
'''
from pysle import isletool
from pysle import pronunciationtools
# In this first example we look up the syllabification of a word and get it's
# stress information.
searchWord = 'pumpkins'
isleDict = isletool.LexicalTool('islev2.txt')
lookupResults = isleDict.lookup(searchWord)
firstEntry = lookupResults[0]
firstSyllableList = firstEntry[0]
firstStressList = firstEntry[1]
print searchWord
print firstSyllableList, firstStressList # 3rd syllable carries stress
# Here we determine the syllabification of a word, as it was said.
# (Of course, this is just a guess)
print '-'*50
searchWord = 'another'
anotherPhoneList = ['n', '@', 'th', 'r']
returnList = pronunciationtools.findBestSyllabification(isleDict,
searchWord,
anotherPhoneList)
stressedSyllable, syllableList, syllabification, stressedIndex = returnList
print searchWord
print anotherPhoneList
print syllableList # We can see the first syllable was elided