Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/amjith/fuzzyfinder
Fuzzy Finder implemented in Python
https://github.com/amjith/fuzzyfinder
Last synced: about 13 hours ago
JSON representation
Fuzzy Finder implemented in Python
- Host: GitHub
- URL: https://github.com/amjith/fuzzyfinder
- Owner: amjith
- License: bsd-3-clause
- Created: 2015-06-15T08:17:11.000Z (over 9 years ago)
- Default Branch: main
- Last Pushed: 2024-09-08T20:17:11.000Z (3 months ago)
- Last Synced: 2024-12-09T08:47:46.833Z (4 days ago)
- Language: Python
- Size: 140 KB
- Stars: 371
- Watchers: 10
- Forks: 30
- Open Issues: 3
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.rst
- Contributing: CONTRIBUTING.rst
- License: LICENSE
- Authors: AUTHORS.rst
Awesome Lists containing this project
- awesome - fuzzyfinder
- starred-awesome - fuzzyfinder - Fuzzy Finder implemented in Python (Python)
README
===============================
fuzzyfinder
===============================.. image:: https://img.shields.io/travis/amjith/fuzzyfinder.svg
:target: https://travis-ci.org/amjith/fuzzyfinder.. image:: https://img.shields.io/pypi/v/fuzzyfinder.svg
:target: https://pypi.python.org/pypi/fuzzyfinderFuzzy Finder implemented in Python. Matches partial string entries from a list
of strings. Works similar to fuzzy finder in SublimeText and Vim's Ctrl-P
plugin.* Documentation: https://fuzzyfinder.readthedocs.org.
* Source: https://github.com/amjith/fuzzyfinder.. image:: https://raw.githubusercontent.com/amjith/fuzzyfinder/master/screenshots/pgcli-fuzzy.gif
Quick Start
-----------::
$ pip install fuzzyfinder
or
$ easy_install fuzzyfinder
Usage
-----.. code:: python
>>> from fuzzyfinder import fuzzyfinder
>>> suggestions = fuzzyfinder('abc', ['defabca', 'abcd', 'aagbec', 'xyz', 'qux'])
>>> list(suggestions)
['abcd', 'defabca', 'aagbec']>>> # Use a user-defined function to obtain the string against which fuzzy matching is done
>>> collection = ['aa bbb', 'aca xyz', 'qx ala', 'xza az', 'bc aa', 'xy abca']
>>> suggestions = fuzzyfinder('aa', collection, accessor=lambda x: x.split()[1])
>>> list(suggestions)
['bc aa', 'qx ala', 'xy abca']>>> suggestions = fuzzyfinder('aa', ['aac', 'aaa', 'aab', 'xyz', 'ada'])
>>> list(suggestions)
['aaa', 'aab', 'aac', 'ada']>>> # Preserve original order of elements if matches have same rank
>>> suggestions = fuzzyfinder('aa', ['aac', 'aaa', 'aab', 'xyz', 'ada'], sort_results=False)
>>> list(suggestions)
['aac', 'aaa', 'aab', 'ada']Features
--------* Simple, easy to understand code.
* No external dependencies, just the python std lib.How does it work
----------------Blog post describing the algorithm: http://blog.amjith.com/fuzzyfinder-in-10-lines-of-python
Similar Projects
----------------* https://github.com/seatgeek/fuzzywuzzy - Fuzzy matching and auto-correction using levenshtein distance.