def test_all_words(self): sentence_one = [BasicWord('hi'), BasicWord('there')] sentence_two = [BasicWord('ho'), BasicWord('there')] paragraph = Paragraph([Sentence(sentence_one), Sentence(sentence_two)]) all_words = sentence_one + sentence_two for index, word in enumerate(paragraph.all_words()): self.assertEqual(word, all_words[index])
def get_countable_nouns(paragraph: Paragraph) -> List[Noun]: out = [] # Sets are untestable with random.seed for word in paragraph.all_words(): # type: Noun if is_countable_noun(word): base_word = word.to_basic_noun() if base_word not in out: out.append(base_word) return out