Skip to main content

No project description provided

Project description

FuzzDex

Fuzzy Index for Python, written in Rust. Works like an error-tolerant dict, keyed by a human input.

Usecases

I use it for matching parts of user supplied physical addresses to data extracted from OSM map to find streets and cities. Original solution used Elasticsearch database with a fuzzy query, which worked - but was 21x slower.

Example

import fuzzdex
cities = fuzzdex.FuzzDex(max_distance=2)
cities.add_phrase("Warsaw", 1, constraints={1, 2, 3})
cities.add_phrase("Wrocław", 2, constraints={4})

streets = fuzzdex.FuzzDex()
streets.add_phrase("Czerniakowska", 1, constraints={1})
streets.add_phrase("Nowy Świat", 2, constraints={1})
streets.add_phrase("Wawelska", 3, constraints={1})

streets.add_phrase("Czerniawska", 4, constraints={2})

cities.finish()
streets.finish()

cities.search("Warszawa", [], max_distance=3, limit=60)
#    [{'origin': 'Warsaw', 'index': 1, 'token': 'warsaw', 
#      'distance': 3, 'score': 100000.0, 'should_score': 0.0}]
 
streets.search("Nowy", ["świat"], max_distance=2, constraint=1)
#    [{'origin': 'Nowy Świat', 'index': 2, 'token': 'nowy', 
#      'distance': 1, 'score': 1.4999924898147583, 
#      'should_score': 7.499962329864502}]

streets.search("Nowy", ["świat"], constraint=2)
#    []

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

fuzzdex-0.3.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.6 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.5+ x86-64

fuzzdex-0.3.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.6 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.5+ x86-64

fuzzdex-0.3.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.6 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.5+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page