def test_get_phrase_list_from_words(self): r = Rake() word_list = ['red', 'apples', ",", 'are', 'good', 'in', 'flavour'] phrase_list = [('red', 'apples'), ('good', ), ('flavour', )] self.assertEqual(r._get_phrase_list_from_words(word_list), phrase_list) word_list = [ 'keywords', ",", 'which', 'we', 'define', 'as', 'a', 'sequence', 'of', 'one', 'or', 'more', 'words', ",", 'provide', 'a', 'compact', 'representation', 'of', 'a', 'document', '\'', 's', 'content' ] phrase_list = [('keywords', ), ('define', ), ('sequence', ), ('one', ), ('words', ), ('provide', ), ('compact', 'representation'), ('document', ), ('content', )] self.assertEqual(r._get_phrase_list_from_words(word_list), phrase_list)
def test_get_phrase_list_from_words(self): r = Rake() word_list = ["red", "apples", ",", "are", "good", "in", "flavour"] phrase_list = [("red", "apples"), ("good",), ("flavour",)] self.assertEqual(r._get_phrase_list_from_words(word_list), phrase_list) word_list = [ "keywords", ",", "which", "we", "define", "as", "a", "sequence", "of", "one", "or", "more", "words", ",", "provide", "a", "compact", "representation", "of", "a", "document", "'", "s", "content", ] phrase_list = [ ("keywords",), ("define",), ("sequence",), ("one",), ("words",), ("provide",), ("compact", "representation"), ("document",), ("content",), ] self.assertEqual(r._get_phrase_list_from_words(word_list), phrase_list)