python中的通用trie数据结构
pythontrie的Python项目详细描述
python trie:trie数据结构的python实现
python trie在python中包含了我们最喜欢的数据结构trie的甜蜜实现。
用法:
>>> from pythontrie import trie >>> sample_trie = trie() >>> sample_strings = ['heyy', 'heyay', 'heyey', 'hyyy', 'yoyo', 'heeyy', 'hoeyy'] >>> for sample_string in sample_strings: >>> sample_trie.insert(sample_string)
打印建议非常简单:
>>> print(sample_trie.suggestions(prefix='he')
['heyy', heyay', heyey', 'heeyy']
当前功能
- 在trie中添加任意字符串
- 使用前缀搜索建议
- 搜索trie中是否存在任何字符串
pythontrie现在支持所有python版本
安装
要安装pythontrie,只需使用所有时间最喜爱的pip并键入:
$ pip install pythontrie ✨?✨
文档
很快就来。
如何贡献
- 最初的计划是将trie可以提供的所有必要功能集成到这个库中,以便它可以充当 每个和崔玩的人都有一次机会。
- 请提出建议,并随时提出一个问题,并提交一个公关一些合理的功能。试着详细说明 这项功能适用的领域,以便我们所有人都能得到启发:)。
- 我正计划将在tries上所做的研究工作集成到这个库中,以便它能够提供高级功能 具有严格的算法复杂性边界。请随意分享任何论文。