Find parts of long text or data, allowing for some changes/typos.
Go to file
Tal Einat a24d3f7739 nailed down automated testing and deployment, and fixed test_generic_search_cython 2014-04-12 13:10:52 +03:00
benchmarks greatly optimized Cython search function + fixed and added benchmarks 2014-03-28 12:51:32 +03:00
docs additional documentation improvements (mostly examples) 2014-03-12 15:59:37 +02:00
fuzzysearch added C implementation of has_near_matches_substitutions_only 2014-04-12 13:10:34 +03:00
tests nailed down automated testing and deployment, and fixed test_generic_search_cython 2014-04-12 13:10:52 +03:00
.gitignore initial commit (project framework) 2013-11-02 00:34:18 +02:00
.travis.yml nailed down automated testing and deployment, and fixed test_generic_search_cython 2014-04-12 13:10:52 +03:00
AUTHORS.rst initial commit (project framework) 2013-11-02 00:34:18 +02:00
CONTRIBUTING.rst initial commit (project framework) 2013-11-02 00:34:18 +02:00
HISTORY.rst version 0.2.2 2014-03-27 15:36:43 +02:00
LICENSE Initial commit 2013-11-01 15:12:11 -07:00
MANIFEST.in initial commit (project framework) 2013-11-02 00:34:18 +02:00
Makefile nailed down automated testing and deployment, and fixed test_generic_search_cython 2014-04-12 13:10:52 +03:00
README.rst additional documentation improvements (mostly examples) 2014-03-12 15:59:37 +02:00
requirements.txt nailed down automated testing and deployment, and fixed test_generic_search_cython 2014-04-12 13:10:52 +03:00
setup.py nailed down automated testing and deployment, and fixed test_generic_search_cython 2014-04-12 13:10:52 +03:00
test_requirements.txt added support for searching Biopython Seq objects 2014-03-27 15:31:20 +02:00
tox.ini nailed down automated testing and deployment, and fixed test_generic_search_cython 2014-04-12 13:10:52 +03:00

README.rst

===============================
fuzzysearch
===============================

.. image:: https://badge.fury.io/py/fuzzysearch.png
    :target: http://badge.fury.io/py/fuzzysearch

.. image:: https://travis-ci.org/taleinat/fuzzysearch.png?branch=master
        :target: https://travis-ci.org/taleinat/fuzzysearch

.. image:: https://pypip.in/d/fuzzysearch/badge.png
        :target: https://crate.io/packages/fuzzysearch?version=latest


fuzzysearch is useful for finding approximate subsequence matches

* Free software: MIT license
* Documentation: http://fuzzysearch.rtfd.org.

Features
--------

* Fuzzy sub-sequence search: Find parts of a sequence which match a given sub-sequence up to a given maximum Levenshtein distance.

Simple Example
--------------
You can usually just use the `find_near_matches()` utility function, which
chooses a suitable fuzzy search implementation according to the given
parameters:

.. code:: python

    >>> from fuzzysearch import find_near_matches
    >>> find_near_matches('PATTERN', 'aaaPATERNaaa', max_l_dist=1)
    [Match(start=3, end=9, dist=1)]

Advanced Example
----------------
If needed you can choose a specific search implementation, such as
`find_near_matches_with_ngrams()`:

.. code:: python

    >>> sequence = '''\
    GACTAGCACTGTAGGGATAACAATTTCACACAGGTGGACAATTACATTGAAAATCACAGATTGGTCACACACACA
    TTGGACATACATAGAAACACACACACATACATTAGATACGAACATAGAAACACACATTAGACGCGTACATAGACA
    CAAACACATTGACAGGCAGTTCAGATGATGACGCCCGACTGATACTCGCGTAGTCGTGGGAGGCAAGGCACACAG
    GGGATAGG'''
    >>> subsequence = 'TGCACTGTAGGGATAACAAT' #distance 1
    >>> max_distance = 2

    >>> from fuzzysearch import find_near_matches_with_ngrams
    >>> find_near_matches_with_ngrams(subsequence, sequence, max_distance)
    [Match(start=3, end=24, dist=1)]