Skip to content

sumerc/pyctrie

Folders and files

NameName
Last commit message
Last commit date

Latest commit

8974fe9 · Nov 6, 2014

History

75 Commits
Jul 14, 2014
Aug 11, 2014
Jul 2, 2014
Nov 6, 2014
Aug 13, 2014
Aug 11, 2014
May 23, 2014
Nov 6, 2014
Aug 13, 2014
Aug 13, 2014
Jul 25, 2014
Aug 11, 2014

Repository files navigation

Pyctrie

Fast, pure C Trie dictionary

Features:

  • Very fast. Same performance characteristics with Python's dict.
  • Supports fast suffix, prefix, correction (spell) operations.
  • Supports Python 2.6 <= x <= 3.4

Example:

It is just like a dict:

import triez
tr = triez.Trie()
tr[u"foo"] = 1
del trie[u"foo"]

But with extra features:

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:

tr[u"foo"] = 1
tr[u"foobar"] = 1
for x in tr.iter_suffixes(u"foo"):
    print(x)
foo
foobar

License

MIT

Releases

No releases published

Packages

No packages published