Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fuzzyfinder

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fuzzyfinder

Fuzzy Finder implemented in Python.

  • 2.2.0
  • PyPI
  • Socket score

Maintainers
1

=============================== 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/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.

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

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc