match
Match tokenized words and phrases within the original, untokenized, often messy, text.
What it is and what it does
Match is a utility for recovering the character offsets of tokenized words and phrases within their original, untokenized source text. Given a messy, whitespace-irregular, or Unicode-heavy source string and a sequence of tokens (or a single token), it returns all matching spans as (start, end, substring) tuples. This solves the alignment problem that arises when a tokenizer normalizes or splits text in ways that obscure the original character positions—essential for tasks like annotation, error correction, or mapping NLP pipeline outputs back to source documents.
The package handles common real-world messiness: irregular spacing, punctuation normalization (e.g., parentheses converted to -LRB- and -RRB-), and Unicode characters. It depends on nltk and regex for tokenization and pattern matching. The project is no longer actively maintained, with the last release in 2022-10-03 and no commits since 2023-04-11.
Use it for:
- Recover source text spans for tokens output by an NLP tokenizer to annotate or highlight original text.
- Map named entity recognition or part-of-speech tags back to character offsets in messy source documents.
- Align corrected or normalized token sequences with their original positions for error analysis.
- Extract substring context around matched token sequences for debugging tokenization issues.
- Support document annotation workflows where token-level labels must be converted to character offsets.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Maps tokenized words and phrases back to their character offsets in the original, untokenized source text, handling whitespace normalization and Unicode characters.
Yes, if you need token-to-offset alignment and can tolerate an abandoned package. The core functionality is stable and no known vulnerabilities exist. However, consider maintenance risk: no updates since 2022-10-03, and any bugs in Unicode or edge-case handling will not be fixed. Suitable for one-off scripts or internal tools; risky for production systems requiring ongoing support.
Install
match on PyPI
pip
pip install matchuv
uv add matchpoetry
poetry add matchInstalling match
Before you install
High install friction: the package is abandoned (last release 2022-10-03, last commit 2023-04-11) and depends on nltk and regex, which add non-trivial setup overhead. No maintenance activity for an extended period.
License in practice
Licensed under Apache License 2.0 (permissive), allowing commercial and private use with minimal restrictions.
Quickstart
pip install match
import match
result = match.match(original_text, ['token', 'sequence'])
# Returns: [(start_offset, end_offset, 'matched substring'), ...]
Requires nltk and regex as runtime dependencies; Python >= 3.8 required.
Verify before relying
- Whether nltk and regex versions have known incompatibilities or security issues affecting match's usability.
- Whether the abandoned status means critical bugs in Unicode or edge-case tokenization remain unfixed.
- Performance characteristics on very large texts or deeply nested tokenization structures.
Package facts
| License | not declared (permissive) |
| Python support | not specified |
| Install friction | high — source build required |
| Runtime dependencies | none |
| Maintenance | abandoned — 1,411 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,331,116/month — #4,045 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: match-0.3.2.tar.gz
Keywords: tokenization
Tags
More Text Processing packages
A drop-in replacement for Python's standard…
permissive · top 100 on PyPI
pyparsingpyparsing provides a library for building text…
permissive · top 1,000 on PyPI
docutilsDocutils converts plaintext documentation in…
unclear · top 1,000 on PyPI
RapidFuzzRapidFuzz provides fast fuzzy string matching…
permissive · top 1,000 on PyPI
tinycss2tinycss2 parses CSS strings into token and…
permissive · top 1,000 on PyPI
llama-parseLlamaParse parses complex documents (PDFs,…
permissive · top 1,000 on PyPI
tensorflow-textTensorFlow Text provides text preprocessing…
permissive · top 5,000 on PyPI
confusablesDetects and matches words that appear identical…
permissive · top 15,000 on PyPI
segmentsSegments provides Unicode-aware tokenization…
permissive · top 5,000 on PyPI
normalityNormality removes diacritics, punctuation, and…
permissive · top 15,000 on PyPI
tokenizerTokenizes Icelandic text into words,…
permissive · top 15,000 on PyPI
unisegDetermines Unicode text segmentation…
permissive · top 15,000 on PyPI
sacremosesSacremoses provides tokenization,…
permissive · top 5,000 on PyPI
pyucaImplements the Unicode Collation Algorithm to…
permissive · top 15,000 on PyPI
tokenize-rtWraps Python's stdlib tokenize module to enable…
permissive · top 5,000 on PyPI