Skip to main content

fuzzquery is a lightweight package for fuzzy word/phrase searches in a body of text. Tokens are used to determine the number and type of approximations that can be made at a token’s position, within your query.

Installation

To install fuzzquery use the following command-line:

pip install fuzzquery

Documentation

The official documents can be viewed at readthedocs. A version of documents can be viewed by calling python’s built-in help function on any part of the fuzzquery package.

Examples

finditer

import fuzzquery as fq

data = """
I would classify music as one of my favorite hobbies.
I love classical music played by classy musicians for a classic musical.
Beethoven can not be out-classed, music-wise - a man of class, musically gifted.
"""
query = 'class{4} music{5}'

print(f'\n{query.upper()} using skip')
for span, match in fq.finditer(data, query, skip=('classify', ','), ci=True):
    print(f'  {match}')

print(f'\n{query.upper()} no skip')
for span, match in fq.finditer(data, query, ci=True):
    print(f'  {match}')

output:

CLASS{4} MUSIC{5}
  classify music
  classical music
  classy musicians
  classic musical
  classed, music-wise
  class, musically

CLASS{4} MUSIC{5} with skip
  classical music
  classy musicians
  classic musical

iterall

import fuzzquery as fq

data = """
I headed homeward to meet with the Wardens.
When I arrived, I was greeted by a homely man that told me the homestead was awarded 5 million dollars.
We intend to use some of the homage to create a homeless ward.
The first piece of furniture will be my late-friend Homer's wardrobe.
"""

queries = ('home{5}',
           'home{4} ward{4}',
           '{1}ward{=2}{2}',
           'hom{6} {4w} wa{=1}{5}')

for query, span, match in fq.iterall(data, queries, ci=True):
    if query: print(f'\n{query.upper()}')
    print(f'  {match}')

output:

HOME{5}
  homeward
  homely
  homestead
  homeless
  Homer's

HOME{4} WARD{4}
  homeless ward
  Homer's wardrobe

{1}WARD{=2}{2}
  Wardens
  awarded
  wardrobe

HOM{6} {4W} WA{=1}{5}
  homeward to meet with the Wardens
  homestead was
  homage to create a homeless ward
  Homer's wardrobe

Release files for fuzzquery 24.5.28

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fuzzquery 24.5.28
File Size Uploaded
fuzzquery-24.5.28.tar.gz 5.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fuzzquery 24.5.28
File Interpreter ABI Platform
fuzzquery-24.5.28-py3-none-any.whl Python 3 none any Details

Total release size: 10.1 kB

Release files / fuzzquery-24.5.28.tar.gz

Download URL fuzzquery-24.5.28.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
72dec5b2c621a5137b4ee4c81f7ec42822de878650d5e806c9c1fe17212b97e1
BLAKE2b-256 checksum
How to use checksums
2cb6f9158879f2047f9f7779c4cb577047f8ddd51bb20b9573570c4d7e0b104d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.0

Release files / fuzzquery-24.5.28-py3-none-any.whl

Download URL fuzzquery-24.5.28-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a8075fa95d1c20586a8b4d3919b1fc6ea13aa9b0f26d29d37793be2dfaf7aac9
BLAKE2b-256 checksum
How to use checksums
4edc64075aedfab612d831414b0cd666d39faaf7f4135570da1e441145a8f645
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.0

Release history Release notifications | RSS feed

This release

24.5.28 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page