示例#1
0
 def test_find_ood_words_does_not_return_duplicates(self):
     self.assertEqual(
         ["antlion", "lazer"],
         isletool.findOODWords(
             self.isle, ["antlion", "brown", "cat", "antlion", "cat", "lazer"]
         ),
     )
示例#2
0
firstEntry = lookupResults[0][0]
firstSyllableList = firstEntry[0]
firstSyllableList = ".".join(
    [u" ".join(syllable) for syllable in firstSyllableList])
firstStressList = firstEntry[1]

print(searchWord)
print(firstSyllableList)
print(firstStressList)  # 3rd syllable carries stress

# In the second example, we probe what words are in the dictionary
print('-' * 50)

wordList = ["another", "banana", "floplot"]
oodWordList = isletool.findOODWords(isleDict, wordList)
print("The following words are not in the dictionary")
print(oodWordList)

# In the third example, we see how many phones are in a pronunciation
print('-' * 50)
syllableCount, phoneCount = isletool.getNumPhones(isleDict, "catatonic", True)
print("%s: %d phones, %d syllables" % ("catatonic", phoneCount, syllableCount))

# In the fourth example, we try to find word pairs in the dictionary
# Once, found, they could be fed into findBestSyllabification() for
# example.
print('-' * 50)
sentenceList = ["another", "australian", "seal", "pumpkins", "parley"]
retList = isletool.autopair(isleDict, sentenceList)[0]
for sentence in retList:
示例#3
0
    stressedSyllableIndexList, stressedPhoneIndexList,
    flattenedStressIndexList) = returnList[0]
print(searchWord)
print(anotherPhoneList)
print(stressedSyllableIndexList)  # We can see the first syllable was elided
print(stressedPhoneIndexList)
print(flattenedStressIndexList)
print(syllableList)
print(syllabification)


# In the third example, we probe what words are in the dictionary
print('-' * 50)

wordList = ["another", "banana", "floplot"]
oodWordList = isletool.findOODWords(isleDict, wordList)
print("The following words are not in the dictionary")
print(oodWordList)


# In the forth example, we see how many phones are in a pronunciation
print('-' * 50)
syllableCount, phoneCount = isletool.getNumPhones(isleDict,
                                                  "catatonic",
                                                  True)
print("%s: %d phones, %d syllables" % ("catatonic",
                                       phoneCount,
                                       syllableCount))


# In the fifth example, we try to find word pairs in the dictionary
示例#4
0
 def test_find_ood_words(self):
     self.assertEqual(
         ["antlion", "lazer"],
         isletool.findOODWords(self.isle, ["brown", "lazer", "cat", "antlion"]),
     )