Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def checkFunc(word):
try:
isleDict.lookup(word)
except isletool.WordNotInISLE:
returnVal = False
else:
returnVal = True
return returnVal
'''
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
def __init__(self, word):
super(WordNotInISLE, self).__init__()
self.word = word
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