def test_autopair_with_ood_words_is_ok(self): # autopair tests for the presence of word combinations, not individual # words self.assertEqual( ([["brown_cat", "antlion"]], [0]), isletool.autopair(self.isle, ["brown", "cat", "antlion"]), )
def test_autopair_with_multiple_matches(self): self.assertEqual( ( [ ["another", "brown_cat", "brown", "cat"], ["another", "brown", "cat", "brown_cat"], ], [1, 3], ), isletool.autopair(self.isle, ["another", "brown", "cat", "brown", "cat"]), )
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: print(sentence) # In the fifth example, we try to get a pronunciation for a whole # sentence all at once. print('-' * 50) sentence = "do you want another pumpkinseed" phoneList = isletool.transcribe(isleDict, sentence, 'longest') print(phoneList)
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 # Once, found, they could be fed into findBestSyllabification() for # example. sentenceList = ["another", "australian", "seal", "pumpkins", "parley"] retList = isletool.autopair(isleDict, sentenceList)[0] for sentence in retList: print(sentence)
def test_autopair(self): self.assertEqual( ([["another", "brown_cat", "brown"]], [1]), isletool.autopair(self.isle, ["another", "brown", "cat", "brown"]), )