Skip to main content

Static memory-efficient and fast Trie-like structures for Python.

Project description

marisa-trie

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.

Installation

pip install marisa-trie

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.

CHANGES

0.7.4 (2017-03-27)

  • Fixed packaging issue, MANIFEST.in was not updated after libmarisa-trie became a submodule.

0.7.3 (2017-02-14)

  • Added BinaryTrie for storing arbitrary sequences of bytes, e.g. IP addresses (thanks Tomasz Melcer);

  • Deprecated Trie.has_keys_with_prefix which can be trivially implemented in terms of Trie.iterkeys;

  • Deprecated Trie.read and Trie.write which onlywork for “real” files and duplicate the functionality of load and save. See issue #31 on GitHub;

  • Updated libmarisa-trie to the latest version. Yay, 64-bit Windows support.

  • Rebuilt Cython wrapper with Cython 0.25.2.

0.7.2 (2015-04-21)

  • packaging issue is fixed.

0.7.1 (2015-04-21)

  • setup.py is switched to setuptools;

  • a tiny speedup;

  • wrapper is rebuilt with Cython 0.22.

0.7 (2014-12-15)

  • trie1 == trie2 and trie1 != trie2 now work (thanks Sergei Lebedev);

  • for key in trie: is fixed (thanks Sergei Lebedev);

  • wrapper is rebuilt with Cython 0.21.1 (thanks Sergei Lebedev);

  • https://bitbucket.org/kmike/marisa-trie repo is no longer supported.

0.6 (2014-02-22)

  • New Trie methods: __getitem__, get, items, iteritems. trie[u'key'] is now the same as trie.key_id(u'key').

  • small optimization for BytesTrie.get.

  • wrapper is rebuilt with Cython 0.20.1.

0.5.3 (2014-02-08)

  • small Trie.restore_key optimization (it should work 5-15% faster)

0.5.2 (2014-02-08)

  • fix Trie.restore_key method - it was reading past declared string length;

  • rebuild wrapper with Cython 0.20.

0.5.1 (2013-10-03)

0.5 (2013-05-07)

  • BytesTrie.iterkeys, BytesTrie.iteritems, RecordTrie.iterkeys and RecordTrie.iteritems methods;

  • wrapper is rebuilt with Cython 0.19;

  • value_separator parameter for BytesTrie and RecordTrie.

0.4 (2013-02-28)

  • improved trie building: weights optional parameter;

  • improved trie building: unnecessary input sorting is removed;

  • wrapper is rebuilt with Cython 0.18;

  • bundled marisa-trie C++ library is updated to svn r133.

0.3.8 (2013-01-03)

  • Rebuild wrapper with Cython pre-0.18;

  • update benchmarks.

0.3.7 (2012-09-21)

  • Update bundled marisa-trie C++ library (this may fix more mingw issues);

  • Python 3.3 support is back.

0.3.6 (2012-09-05)

  • much faster (3x-7x) .items() and .keys() methods for all tries; faster (up to 3x) .prefixes() method for Trie.

0.3.5 (2012-08-30)

  • Pickling of RecordTrie is fixed (thanks lazarou for the report);

  • error messages should become more useful.

0.3.4 (2012-08-29)

  • Issues with mingw32 should be resolved (thanks Susumu Yata).

0.3.3 (2012-08-27)

  • .get(key, default=None) method for BytesTrie and RecordTrie;

  • small README improvements.

0.3.2 (2012-08-26)

  • Small code cleanup;

  • load, read and mmap methods returns ‘self’;

  • I can’t run tests (via tox) under Python 3.3 so it is removed from supported versions for now.

0.3.1 (2012-08-23)

  • .prefixes() support for RecordTrie and BytesTrie.

0.3 (2012-08-23)

  • RecordTrie and BytesTrie are introduced;

  • IntTrie class is removed (probably temporary?);

  • dumps/loads methods are renamed to tobytes/frombytes;

  • benchmark & tests improvements;

  • support for MARISA-trie config options is added.

0.2 (2012-08-19)

  • Pickling/unpickling support;

  • dumps/loads methods;

  • python 3.3 workaround;

  • improved tests;

  • benchmarks.

0.1 (2012-08-17)

Initial release.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

marisa-trie-0.7.4.tar.gz (232.7 kB view details)

Uploaded Source

Built Distributions

marisa_trie-0.7.4-cp36-cp36m-win_amd64.whl (140.6 kB view details)

Uploaded CPython 3.6m Windows x86-64

marisa_trie-0.7.4-cp36-cp36m-win32.whl (115.9 kB view details)

Uploaded CPython 3.6m Windows x86

marisa_trie-0.7.4-cp36-cp36m-manylinux1_x86_64.whl (870.9 kB view details)

Uploaded CPython 3.6m

marisa_trie-0.7.4-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (351.2 kB view details)

Uploaded CPython 3.6m macOS 10.10+ intel macOS 10.10+ x86-64 macOS 10.6+ intel macOS 10.9+ intel macOS 10.9+ x86-64

marisa_trie-0.7.4-cp35-cp35m-win_amd64.whl (139.3 kB view details)

Uploaded CPython 3.5m Windows x86-64

marisa_trie-0.7.4-cp35-cp35m-win32.whl (114.9 kB view details)

Uploaded CPython 3.5m Windows x86

marisa_trie-0.7.4-cp35-cp35m-manylinux1_x86_64.whl (863.1 kB view details)

Uploaded CPython 3.5m

marisa_trie-0.7.4-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (348.2 kB view details)

Uploaded CPython 3.5m macOS 10.10+ intel macOS 10.10+ x86-64 macOS 10.6+ intel macOS 10.9+ intel macOS 10.9+ x86-64

marisa_trie-0.7.4-cp34-cp34m-manylinux1_x86_64.whl (871.1 kB view details)

Uploaded CPython 3.4m

marisa_trie-0.7.4-cp27-cp27mu-manylinux1_x86_64.whl (823.1 kB view details)

Uploaded CPython 2.7mu

marisa_trie-0.7.4-cp27-cp27m-win_amd64.whl (129.4 kB view details)

Uploaded CPython 2.7m Windows x86-64

marisa_trie-0.7.4-cp27-cp27m-win32.whl (107.1 kB view details)

Uploaded CPython 2.7m Windows x86

marisa_trie-0.7.4-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (347.5 kB view details)

Uploaded CPython 2.7m macOS 10.10+ intel macOS 10.10+ x86-64 macOS 10.6+ intel macOS 10.9+ intel macOS 10.9+ x86-64

marisa_trie-0.7.4-cp26-cp26mu-manylinux1_x86_64.whl (821.3 kB view details)

Uploaded CPython 2.6mu

marisa_trie-0.7.4-cp26-cp26m-win_amd64.whl (129.6 kB view details)

Uploaded CPython 2.6m Windows x86-64

marisa_trie-0.7.4-cp26-cp26m-win32.whl (107.2 kB view details)

Uploaded CPython 2.6m Windows x86

File details

Details for the file marisa-trie-0.7.4.tar.gz.

File metadata

  • Download URL: marisa-trie-0.7.4.tar.gz
  • Upload date:
  • Size: 232.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for marisa-trie-0.7.4.tar.gz
Algorithm Hash digest
SHA256 2a2258eacca9966325f9019378fc4621891f2482bc63e6441f70599595ed97d8
MD5 0216cc134dc13366c78b74197ea57bf5
BLAKE2b-256 3f67ca798a3f931a7aa192c40d148313693eccb843ddb536144cbe994311020c

See more details on using hashes here.

File details

Details for the file marisa_trie-0.7.4-cp36-cp36m-win_amd64.whl.

File metadata

File hashes

Hashes for marisa_trie-0.7.4-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 212eb066ba52720bec8722454e80a9e29ab0454da980ebd7093148c2e7bdb63e
MD5 9265cb255a7d7c9791e63a93cbfd124a
BLAKE2b-256 5b66dff70874aad794a859e19ec8213bf86ae9937afad77f1664c95a3be592c5

See more details on using hashes here.

File details

Details for the file marisa_trie-0.7.4-cp36-cp36m-win32.whl.

File metadata

File hashes

Hashes for marisa_trie-0.7.4-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 8870bc435ac9bd8aed483169f9008dbf9e40ae56cc3cb02a670fbb5d66975e11
MD5 df1750d88faa0a9733a7db900b4c7319
BLAKE2b-256 c416e0b35f9e6f7a8488973923d108568cf37e2e07f73135a1d567d0282fe79e

See more details on using hashes here.

File details

Details for the file marisa_trie-0.7.4-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for marisa_trie-0.7.4-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 32cbf5d5a6630e8bd6015fa7600f3e076bc321bf9768e6d4d41e751004ff6657
MD5 09247a3432626f52db6d0037ad0b4b11
BLAKE2b-256 1b5f21295ebb1feb1abde1e7652c0a4c182b4c25bdd5dda5a0f5b34d4e88bcc3

See more details on using hashes here.

File details

Details for the file marisa_trie-0.7.4-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl.

File metadata

File hashes

Hashes for marisa_trie-0.7.4-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm Hash digest
SHA256 65d873f2cdf22a59ee332aef827c08051019cc701beb54f2384b31dd83865321
MD5 41f92c7ed096875a60fe51b6e7ce07d8
BLAKE2b-256 1226a4ee83b318ee9cbcf2f403e3dd28df06817850353802b2753a26d69f88de

See more details on using hashes here.

File details

Details for the file marisa_trie-0.7.4-cp35-cp35m-win_amd64.whl.

File metadata

File hashes

Hashes for marisa_trie-0.7.4-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 f24540335c08b64a623c3622eb69b39a23003147cbabc75e06b49aded59962eb
MD5 7cc60fbe55db11234143b36df9f5991c
BLAKE2b-256 224e028ab846ab39b9a703b230a724d66cdddfb6f4a05ca2b9c405f9779421b4

See more details on using hashes here.

File details

Details for the file marisa_trie-0.7.4-cp35-cp35m-win32.whl.

File metadata

File hashes

Hashes for marisa_trie-0.7.4-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 c1200407b66dff3a31b505843f1f9c61431595c20972496a9ff4eaaecb792b35
MD5 5e2e4c32b0fb4a43d792bd51e7e86a9f
BLAKE2b-256 e845736d86e3701e41aa23202e84e727974ad5e14913a6d0bb26261a48731807

See more details on using hashes here.

File details

Details for the file marisa_trie-0.7.4-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for marisa_trie-0.7.4-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 accdaedcb86bac8fd6748c99dd577dd65a76026872bb5873626f3f401f57a043
MD5 620b537587ba5dc288af4300859a2ed6
BLAKE2b-256 d32a3d64c70eaaf0dbd896b88ce46d9a7da0f2f7b59deee03ea3155b0eab46a6

See more details on using hashes here.

File details

Details for the file marisa_trie-0.7.4-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl.

File metadata

File hashes

Hashes for marisa_trie-0.7.4-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm Hash digest
SHA256 6c8a79ca2e469b12b0bbd2927273c850873a7780bcecc3dd4c01ab30fa8c0346
MD5 f0b9122398e228e55a9e2d109229c123
BLAKE2b-256 b8b164744354cc7878e8bfe1d2e793f72ba453cece59be59963454f286527b1b

See more details on using hashes here.

File details

Details for the file marisa_trie-0.7.4-cp34-cp34m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for marisa_trie-0.7.4-cp34-cp34m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 ef381b579aee59098652a5fe5b5d9a93f4c93b21cd74d825fbb84c4447c21d83
MD5 feaed884aeedc795bd9ee76a15ecb0fc
BLAKE2b-256 59c90b9c3206d018737d712e7e37e44a1926f0d2dae3080837925b24ddab1b12

See more details on using hashes here.

File details

Details for the file marisa_trie-0.7.4-cp27-cp27mu-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for marisa_trie-0.7.4-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 89bd183e0f75357f074658492bb24a4bbac8e1a13fd0f54553017c122eeef134
MD5 d6ea90606b9e720aaca20798803c829d
BLAKE2b-256 278cc8d95695002364b8bb203d786de754be9bde566e5c00efa00941874e508b

See more details on using hashes here.

File details

Details for the file marisa_trie-0.7.4-cp27-cp27m-win_amd64.whl.

File metadata

File hashes

Hashes for marisa_trie-0.7.4-cp27-cp27m-win_amd64.whl
Algorithm Hash digest
SHA256 e89c07d52b8f385a9afb617f6b90f0632551ab58f1467edea1158d0837c8b097
MD5 e8cc1947cf75a75e2f66af62d9c3c8b5
BLAKE2b-256 daa75f13eed63b6a5baa2fd8196054dae7eaceb679421157ca494afde44ad672

See more details on using hashes here.

File details

Details for the file marisa_trie-0.7.4-cp27-cp27m-win32.whl.

File metadata

File hashes

Hashes for marisa_trie-0.7.4-cp27-cp27m-win32.whl
Algorithm Hash digest
SHA256 e45291a022b5e680f393b4406202bfc6e9380dccd8d79b1627b3e4c0d98d457d
MD5 649b1dd8fa97eade84ee74de12f5eb24
BLAKE2b-256 080fbeb80192abcaae68b47c259f230994bce3c002416d937d5ebeaf252dc09e

See more details on using hashes here.

File details

Details for the file marisa_trie-0.7.4-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl.

File metadata

File hashes

Hashes for marisa_trie-0.7.4-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm Hash digest
SHA256 26b7adaaa3bd3b6b8aaa9a9d0cc33f7ce0b0e6b85c1b0d0c591a7fd8f25ba001
MD5 ba3aa0b25a21324d5ee8f29a86562809
BLAKE2b-256 8d2c30d7504c2e1404a61fb561abe11b2b30eff5ffa004d6852d35894d1f78f2

See more details on using hashes here.

File details

Details for the file marisa_trie-0.7.4-cp26-cp26mu-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for marisa_trie-0.7.4-cp26-cp26mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 dd1b5464d7ea2eb54758dcde40385d12e75cf74f6a44d27459ccb8c282ebc8c8
MD5 8d5a36d911f6be10ea062f9b67b108c4
BLAKE2b-256 6458899be44adfbbc2e701aec9af82fbbc11b4f7ad8330236d8e6049653b6ed7

See more details on using hashes here.

File details

Details for the file marisa_trie-0.7.4-cp26-cp26m-win_amd64.whl.

File metadata

File hashes

Hashes for marisa_trie-0.7.4-cp26-cp26m-win_amd64.whl
Algorithm Hash digest
SHA256 4cf4ff5bd9a135c3d1f6ab662b8dc6357ff502adc45c031f32e4c44f74268e22
MD5 ff0f09aa10f88d0253ad267f88e70076
BLAKE2b-256 cf58526e3957aaee9f3ae039b8daa61d94b955e3743aad049b54094391bb2e6e

See more details on using hashes here.

File details

Details for the file marisa_trie-0.7.4-cp26-cp26m-win32.whl.

File metadata

File hashes

Hashes for marisa_trie-0.7.4-cp26-cp26m-win32.whl
Algorithm Hash digest
SHA256 0e94d38468e454718577aa6994af12f66f24099a94c202f2f13c714be0c90d45
MD5 00dbb9440fdb32465141e77dcb7b1d0d
BLAKE2b-256 a614a9735a38d85876c28a2e14862e54931b0cf2b8ad0b2b1be73ff0a8b1d9fb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page