Metadata-Version: 2.3
Name: matcher_py
Version: 0.1.0
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python
Classifier: Programming Language :: Rust
Classifier: Typing :: Typed
Requires-Dist: cffi
Requires-Dist: typing-extensions
Requires-Dist: msgspec
Requires-Dist: numpy
Summary: A high performance multiple functional word matcher
Keywords: text,string,search,pattern,multi
Home-Page: https://github.com/Lips7/Matcher
Author: Fuji Guo
Author-email: f975793771@gmail.com
License: MIT OR Apache-2.0
Requires-Python: >=3.8
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: homepage, https://github.com/Lips7/Matcher

# Matcher Rust Implement PyO3 binding
## Usage
Python usage is in the [test.ipynb](matcher_py/test.ipynb) file.
```Python
import msgspec

from matcher_py import Matcher, SimpleMatcher # type: ignore
from extension_types import MatchTableType, SimpleMatchType, MatchTable, MatchTableDict, SimpleWord, SimpleWordlistDict

msgpack_encoder = msgspec.msgpack.Encoder()

matcher = Matcher(
    msgpack_encoder.encode(
        {
            "test": [
                MatchTable(
                    table_id=1,
                    match_table_type=MatchTableType.Simple,
                    wordlist=["xxx"],
                    exemption_wordlist=[],
                    simple_match_type=SimpleMatchType.MatchFanjian | SimpleMatchType.MatchDeleteNormalize
                )
            ]
        }
    )
)

print(matcher.word_match("xxx")) # {"test": "[{"table_id":1,"word":"xxx"}]"}
print(matcher.word_match_as_string("xxx")) # "{"test": "[{"table_id":1,"word":"xxx"}]"}"
print(matcher.batch_word_match_as_string(["xxx", "xx"])) # ["{"test": "[{"table_id":1,"word":"xxx"}]"}"]

simple_matcher = SimpleMatcher(
    msgpack_encoder.encode({
      SimpleMatchType.MatchFanjian
      | SimpleMatchType.MatchDeleteNormalize: [
        {
          "word_id": 1,
          "word": "xxx"
        }
      ]
    })
)

print(simple_matcher.simple_process("xxx")) # [{"word_id":1,"word":"xxx"}]
print(simple_matcher.batch_simple_process(["xxx", "xx"])) # [[{"word_id":1,"word":"xxx"}], []]
```
