• Stars
    star
    369
  • Rank 115,686 (Top 3 %)
  • Language
    Python
  • License
    BSD 3-Clause "New...
  • Created over 9 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Fuzzy Finder implemented in Python

fuzzyfinder

Fuzzy 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.

https://raw.githubusercontent.com/amjith/fuzzyfinder/master/screenshots/pgcli-fuzzy.gif

Quick Start

$ pip install fuzzyfinder

or

$ easy_install fuzzyfinder

Usage

>>> 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

More Repositories

1

prompt_toolkit_tutorial

Tutorial for building an SQLite cli using python-prompt-toolkit library
Python
51
star
2

fuzzyfind

Fuzzy matching algorithm for finding and ranking a list based on partial user input.
JavaScript
13
star
3

_dotties

*nix dot_files
Shell
8
star
4

User-Group-Presentations

Presentations done in local user group meetings
Python
5
star
5

zazu-mac-open-terminal

JavaScript
5
star
6

Inc_search

Incremental search
C++
4
star
7

PyAlarmTimer

Alarm Clock in Python
Python
4
star
8

zazu-mac-vpn

Toggle VPN connection.
JavaScript
3
star
9

ghopen.nvim

NeoVim Plugin to open current file in the GH UI
Lua
3
star
10

haskellcode

Learning Code for Haskell
2
star
11

window_monitor

Monitor the top most window and record to a file. Productivity monitor
Python
2
star
12

readable

Convert a webpage more readable in terminal
Python
2
star
13

Cows_and_Bulls-Game

Text based word game Cows and Bulls written in Python
Python
2
star
14

utosc_python_profiling

Python Profiling presentation at UTOSC 2012
Python
2
star
15

.emacs.d

Emacs config files and various plugins
Emacs Lisp
2
star
16

dot_vim

vim config
Vim Script
1
star
17

django-api-tutorial

Project used at PyCon '18 django-api tutorial
1
star
18

test

This is a test
1
star
19

hw4_rottenpotatoes

Ruby
1
star
20

notes

Vimwiki style notes
1
star
21

pyqt_presentation

PyQt4 Presentation Slides
1
star
22

hw3_rottenpotatoes

HW 3 skeleton for doing BDD with RottenPotatoes
Ruby
1
star
23

LearnJava

Java
1
star
24

dotties_old

Shell
1
star
25

py_bits

Python bits
Python
1
star
26

flask-skel

Flask Skeleton Project
Python
1
star
27

docker-presentation

Demo files for Intro to Docker presentation at PyCon and DjangoCon EU 2014
Shell
1
star
28

old_dot_vim

Old Vim Config
Vim Script
1
star
29

git_present

Git Hands On - Presentation
1
star
30

simple-react-app

Simple React App
JavaScript
1
star
31

lisp

Lisp - Learning Files
Emacs Lisp
1
star
32

pong

Elm
1
star