Registry / search / tfidf-matcher

tfidf-matcher

JSON →
library0.3.0pypypi✓ verified 81d ago

A small Python package for super-fast TF-IDF based string matching. Version 0.3.0 is the latest stable release. The package is in active development, though commits are infrequent.

pip install tfidf-matcher
INSTALL
IMPORT
SIG · TFIDF-MATCHER
T
tfidf-matcher
searchpythonv0.3.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

matcher
from tfidf_matcher import matcher
from tfidf_matcher import TFIDFMatcher

Initialize TFIDFMatcher, fit on a list of strings, then match new strings to the closest fit.

from tfidf_matcher import TFIDFMatcher # Example data recipes = ['Spaghetti Bolognese', 'Chicken Tikka Masala', 'Beef Stew'] menu_items = ['Spaghetti Bolognese', 'Chicken Tikka', 'Beef Stew with Dumplings'] # Initialize and fit matcher = TFIDFMatcher() matcher.fit(recipes) # Match matches = matcher.transform(menu_items) print(matches)
Debug
Known issues
gotchaThe package name on PyPI is `tfidf-matcher` (with a hyphen), but the Python module is `tfidf_matcher` (with an underscore). This mismatch often causes ImportError if users try to import the hyphenated name.
fix
Always `pip install tfidf-matcher` and import as `from tfidf_matcher import TFIDFMatcher`.
affects: all
gotchaThe fit() method expects a list of strings (corpus). Passing a single string will not raise an error immediately but leads to character-level matching, which gives incorrect results.
fix
Always pass a list, even for a single document: `matcher.fit(['single string'])`.
affects: all
deprecatedThe package explicitly supports Python 3.5+ but may not be tested on Python 3.12+. The underlying scikit-learn dependency may have compatibility issues.
fix
Use virtual environment with Python 3.8-3.11 for best compatibility.
affects: >=0.3.0
Upgrade
Version history
0.3.0latest on PyPI · released Apr 6, 2023
Audit
Dependencies

No dependency data recorded yet.

Agent activity
33 hits · last 30 days
node
28
OpenAI (training)
1
Resources
tfidf-matcher — pip install tfidf-matcher · libregistry