self.trie_dict = Trie(custom_dict)
elif type(custom_dict) is str:
with codecs.open(custom_dict, "r",encoding="utf8") as f:
vocabs = [word.rstrip() for word in f.readlines()]
self.trie_dict = Trie(vocabs)
else:
self.trie_dict = Trie(get_dict())
After Change
self.trie_dict = Trie(custom_dict)
elif type(custom_dict) is str:
with codecs.open(custom_dict, "r",encoding="utf8") as f:
vocabs = f.read().splitlines()
self.trie_dict = Trie(vocabs)
else:
self.trie_dict = Trie(get_dict())