|travis| |coveralls| |pyversion| |version| |license|
Shellinford is an implementation of a Wavelet Matrix/Tree succinct data structure for document retrieval.
It is based on shellinford
_ C++ library.
.. _shellinford: https://github.com/echizentm/shellinford
NOTE: This module requires C++11 compiler
::
$ pip install shellinford
.. code:: python
import shellinford fm = shellinford.FMIndex()
shellinford.Shellinford([use_wavelet_tree=True, filename=None])
.. code:: python
fm.build(['Milky Holmes', 'Sherlock "Sheryl" Shellingford', 'Milky'], 'milky.fm')
build([docs, filename])
.. code:: python
for doc in fm.search('Milky'): print('doc_id:', doc.doc_id) print('count:', doc.count) print('text:', doc.text) doc_id: 0 count: [1] text: Milky Holmes doc_id: 2 count: [1] text: Milky
for doc in fm.search(['Milky', 'Holmes']): print('doc_id:', doc.doc_id) print('count:', doc.count) print('text:', doc.text) doc_id: 1 count: [1] text: Milky Holmes
search(query, [_or=False, ignores=[]])
_or
= True, then "OR" search is executed, else "AND" searchignores
, "NOT" search is also executed.. code:: python
fm.count('Milky'): 2
fm.count(['Milky', 'Holmes']): 1
count(query, [_or=False])
_or
= True, then "OR" search is executed, else "AND" search.. code:: python
fm.push_back('Baritsu')
push_back(doc)
.. code:: python
fm.read('milky_holmes.fm')
.. code:: python
fm.write('milky_holmes.fm')
.. code:: python
'baritsu' in fm
shellinford
_ C++ library (c) 2012 echizen_tm is licensed under the New BSD License... |travis| image:: https://travis-ci.org/ikegami-yukino/shellinford-python.svg?branch=master :target: https://travis-ci.org/ikegami-yukino/shellinford-python :alt: travis-ci.org
.. |coveralls| image:: https://coveralls.io/repos/ikegami-yukino/shellinford-python/badge.svg?branch=master&service=github :target: https://coveralls.io/github/ikegami-yukino/shellinford-python?branch=master :alt: coveralls.io
.. |pyversion| image:: https://img.shields.io/pypi/pyversions/shellinford.svg
.. |version| image:: https://img.shields.io/pypi/v/shellinford.svg :target: http://pypi.python.org/pypi/shellinford/ :alt: latest version
.. |license| image:: https://img.shields.io/pypi/l/shellinford.svg :target: http://pypi.python.org/pypi/shellinford/ :alt: license