gehu1107 / marisa-trie

Static memory-efficient Trie-like structures for Python (2.x and 3.x) based on marisa-trie C++ library.

Home Page:http://marisa-trie.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

marisa-trie travis appveyor

Static memory-efficient Trie-like structures for Python (2.x and 3.x) based on marisa-trie C++ library.

String data in a MARISA-trie may take up to 50x-100x less memory than in a standard Python dict; the raw lookup speed is comparable; trie also provides fast advanced methods like prefix search.

Note

There are official SWIG-based Python bindings included in C++ library distribution; this package provides alternative Cython-based pip-installable Python bindings.

Installation

pip install marisa-trie

Usage

See :ref:`Tutorial <tutorial>` and :ref:`API <api>` for details.

Current limitations

  • The library is not tested with mingw32 compiler;
  • .prefixes() method of BytesTrie and RecordTrie is quite slow and doesn't have iterator counterpart;
  • read() and write() methods don't work with file-like objects (they work only with real files; pickling works fine for file-like objects);
  • there are keys() and items() methods but no values() method.

License

Wrapper code is licensed under MIT License.

Bundled marisa-trie C++ library is dual-licensed under LGPL and BSD 2-clause license.

About

Static memory-efficient Trie-like structures for Python (2.x and 3.x) based on marisa-trie C++ library.

http://marisa-trie.readthedocs.io

License:MIT License


Languages

Language:Python 84.0%Language:PowerShell 10.8%Language:Batchfile 5.1%Language:Shell 0.1%