pytries / marisa-trie

Static memory-efficient Trie-like structures for Python based on marisa-trie C++ library.
https://marisa-trie.readthedocs.io/en/latest/
MIT License
1.03k stars 91 forks source link

input file format documentation missing #48

Open mbspng opened 6 years ago

mbspng commented 6 years ago

Edit: nvm, misunderstood purpose of Trie.load.

The documentation does not explain what format is expected for files passed to load. I tried the following:

In [1]: import marisa_trie

In [2]: trie = marisa_trie.Trie()

In [3]: trie.load('data')
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-3-d813dec57587> in <module>()
----> 1 trie.load('data')

src/marisa_trie.pyx in marisa_trie._Trie.load()

src/marisa_trie.pyx in marisa_trie._Trie.load()

RuntimeError: marisa-trie/lib/marisa/grimoire/trie/header.h:26: MARISA_FORMAT_ERROR: !test_header(buf)

Documentation does not specify what the file should be formatted like:

In [4]: trie.load?
Docstring:
_Trie.load(self, path)
Load a trie from a specified path.
Type:      builtin_function_or_method