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
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']).
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.

Basic usage: create a Matcher with a list of strings and call .match() to get matched patterns.

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']