How to use the pysle.isletool.WordNotInISLE 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 / pysle / praattools.py View on Github external
def checkFunc(word):
        try:
            isleDict.lookup(word)
        except isletool.WordNotInISLE:
            returnVal = False
        else:
            returnVal = True

        return returnVal
github timmahrt / pysle / pysle / isletool.py View on Github external
'''
        Lookup a word and receive a list of syllables and stressInfo

        Output example for the word 'another' which has two pronunciations
        [(([[u'ə'], [u'n', u'ˈʌ'], [u'ð', u'ɚ']], [1], [1]),
          ([[u'ə'], [u'n', u'ˈʌ'], [u'ð', u'ə', u'ɹ']], [1], [1]))]
        '''

        # All words must be lowercase with no extraneous whitespace
        word = word.lower()
        word = word.strip()

        pronList = self.data.get(word, None)

        if pronList is None:
            raise WordNotInISLE(word)

        pronList = [_parsePronunciation(pronunciationStr)
                    for pronunciationStr, _ in pronList]
        pronList = list(zip(*pronList))

        return pronList
github timmahrt / pysle / pysle / isletool.py View on Github external
def __init__(self, word):
        super(WordNotInISLE, self).__init__()
        self.word = word
github timmahrt / pysle / pysle / isletool.py View on Github external
def findOODWords(isleDict, wordList):
    '''
    Returns all of the out-of-dictionary words found in a list of utterances
    '''
    oodList = []
    for word in wordList:
        try:
            isleDict.lookup(word)
        except WordNotInISLE:
            oodList.append(word)

    oodList = list(set(oodList))
    oodList.sort()

    return oodList