为什么我不能通过 pygtrie 在 trie 中添加单词?
Why can't I add word in a trie via pygtrie?
我想构建一个 trie 来记录短语。因此单位是单词而不是字符。而且我通过googlehere. But according to their documentation找到了一个有前途的实现,没有add
函数。我想知道我怎样才能 add/insert 一个词到一个特里树?提前致谢!
此 trie 实现提供与 dict 相同的接口。您的 add
函数将只是 mytrie[key] = value
.
我想构建一个 trie 来记录短语。因此单位是单词而不是字符。而且我通过googlehere. But according to their documentation找到了一个有前途的实现,没有add
函数。我想知道我怎样才能 add/insert 一个词到一个特里树?提前致谢!
此 trie 实现提供与 dict 相同的接口。您的 add
函数将只是 mytrie[key] = value
.