def weak_common_prefix_generate(self, chapter_list): """ """ trie = Trie() for chapter in chapter_list: trie.insert_string(chapter.chapter_title) common_prefix_list = trie.find_common_prefix(trie.root, 10, '') return common_prefix_list
def strong_common_prefix_generate(self, chapter_list): """ """ trie = Trie() for chapter in chapter_list: trie.insert_string(chapter.chapter_title) count = int(len(chapter_list) * 0.7) + 1 common_prefix_list = trie.find_common_prefix(trie.root, count, '') return common_prefix_list