skillfed

match

Match tokenized words and phrases within the original, untokenized, often messy, text.

match v0.3.2 1.3M downloads/30d#4,045 on PyPI20
Permissive license Abandoned released

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 match

uv

uv add match

poetry

poetry add match

Installing 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

License :: OSI Approved :: Apache Software LicenseOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: POSIXOperating System :: UnixProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Text Processing

Tags

token to character offset mappingfind tokens in original texttokenization span alignmentmatch tokens to sourcetext span recoveryunicode-aware token matchingmessy text tokenization
nlp-utilitiestokenizationtext-alignment

More Text Processing packages