matcher-py
raw JSON → 0.15.5 verified Sat May 09 auth: no python
A high-performance matcher designed to solve LOGICAL and TEXT VARIATIONS problems in word matching, implemented in Rust. v0.15.5, actively maintained.
pip install matcher-py Common errors
error ModuleNotFoundError: No module named 'matcher' ↓
cause The library is installed as 'matcher-py' but imported as 'matcher'.
fix
Install with 'pip install matcher-py' and import with 'from matcher import Matcher'.
error TypeError: Matcher() got an unexpected keyword argument 'patterns' ↓
cause Incorrect API usage: Matcher expects positional argument, not keyword.
fix
Correct:
Matcher(['pattern1', 'pattern2']). Warnings
breaking In v0.15.x the API changed: 'Matcher' constructor now expects a list of strings instead of previous dict/list-of-dicts. ↓
fix Upgrade code: replace old initialization with `Matcher([...])`.
gotcha Pattern matching is case-sensitive by default. To enable case-insensitive matching, set `case_sensitive=False` when creating Matcher. ↓
fix Use `Matcher(patterns, case_sensitive=False)`.
gotcha If a pattern contains special regex characters (e.g., '.', '*'), they are treated as literal characters, not regex. This may cause unexpected no-match results. ↓
fix Escape special characters yourself or use raw strings to avoid confusion.
Imports
- Matcher wrong
from matcher_py import Matchercorrectfrom matcher import Matcher
Quickstart
from matcher import Matcher
# Initialize matcher with a list of patterns
patterns = ["hello", "world", "python"]
matcher = Matcher(patterns)
# Match a single text
result = matcher.match("hello world")
print(result) # Output: ['hello', 'world']