Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sumerc/pyctrie
Fast, pure C Trie dictionary
https://github.com/sumerc/pyctrie
data-structures dictionary prefix python spellcheck suffix trie
Last synced: 6 days ago
JSON representation
Fast, pure C Trie dictionary
- Host: GitHub
- URL: https://github.com/sumerc/pyctrie
- Owner: sumerc
- Created: 2019-12-26T11:35:25.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2019-12-26T11:38:26.000Z (about 5 years ago)
- Last Synced: 2024-12-05T10:27:52.078Z (2 months ago)
- Topics: data-structures, dictionary, prefix, python, spellcheck, suffix, trie
- Language: C
- Homepage:
- Size: 354 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Pyctrie
===================
Fast, pure C [Trie](http://en.wikipedia.org/wiki/Trie) dictionaryFeatures:
===================
* Very fast. Same performance characteristics with Python's **dict**.
* Supports fast **suffix**, **prefix**, **correction** (spell) operations.
* Supports Python 2.6 <= x <= 3.4Example:
===================It is just like a dict:
```python
import triez
tr = triez.Trie()
tr[u"foo"] = 1
del trie[u"foo"]
```But with extra features:
```python
tr[u"foo"] = 1
tr.corrections(u"fo")
{'foo'}
tr[u"foobar"] = 1
tr.prefixes(u"foobar")
{'foo', 'foobar'}
tr.suffixes(u"foo")
{'foo', 'foobar'}
```Generator support:
```python
tr[u"foo"] = 1
tr[u"foobar"] = 1
for x in tr.iter_suffixes(u"foo"):
print(x)
foo
foobar
```License
===================MIT