$npx skillfedfor your agent

ahocorapy

ahocorapy - Pure python ahocorasick implementation

Worth itPyPI Python ModulesReleased Jul 202677.4K downloads / moMITPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — ahocorapy-1.8.0-py2.py3-none-any.whl
v1.8.0 · released 2026-07-21 · Python >=2.7

Yes. ahocorapy is worth installing for multi-keyword search when you need a pure-Python, platform-independent solution with unicode support and no compiled dependencies. It is actively maintained, has no security vulnerabilities, carries a permissive MIT license, and performs competitively on typical (sparse) text. Install it if C extensions are unavailable or undesirable; if you are searching very dense text with many overlapping matches and latency is critical, a C-based alternative may be faster.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Tree construction is not thread-safe; concurrent calls to add() have undefined behavior.
  • Finalize the tree before using it in multi-threaded search contexts.
  • Installation is straightforward with no runtime dependencies and low friction.

License · maintenance · safety

MIT (permissive) — MIT license permits unrestricted use, modification, and distribution in both open-source and commercial projects with minimal restrictions.

last release 2026-07-21 (24 days) · last repo commit 2026-07-21 · 217 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 77,375 downloads/mo, #14,530 on PyPI

Verify before relying

pip install ahocorapy

from ahocorapy.keywordtree import KeywordTree
kwtree = KeywordTree(case_insensitive=True)
kwtree.add('malaga')
kwtree.add('lacrosse')
kwtree.finalize()
result = kwtree.search('My favorite islands are malaga and sylt.')
print(result)
  • Whether the library's performance on dense text (0.42s for 100 searches) meets your latency requirements compared to C-extension alternatives.
  • Memory overhead of the suffix-shortcutting optimization relative to other pure-Python implementations in your use case.
  • Whether pickling support for huge keyword trees is tested at the scale your application requires.
Same gist for agents: .md · .json

What it is and what it does

ahocorapy is a pure-Python implementation of the Aho-Corasick algorithm designed to search for multiple keywords in text or arbitrary sequences with linear-time complexity. It was created to address gaps in existing libraries: it supports unicode in Python 2.7 without C extensions (making it platform-independent), and it uses suffix-shortcutting during setup to accelerate lookup times. The library works with any hashable symbols—strings, tuples of integers, lists of tokens, or bytes—making it flexible for character-level, word-level, or token-level matching.

The package trades setup time for faster search performance by precomputing state transitions and match positions. On sparse text it matches C-extension performance on CPython; on dense text (many overlapping matches) it remains slower than C extensions but faster than other pure-Python alternatives. It is fully pickleable using a non-recursive serialization strategy to handle large keyword trees, and it supports case-insensitive matching for string-based searches.

Use it for

  • Scan large documents for a fixed set of names, terms, or patterns without installing compiled dependencies.
  • Perform word-level keyword matching by building a tree from token lists instead of character sequences.
  • Search binary data or custom symbol sequences (tuples, lists) using the same algorithm without string conversion.
  • Serialize and reuse large pre-built keyword trees across application restarts via pickling.
  • Find all overlapping keyword matches in a single pass through text, returning both matches and their positions.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

Yes.

ahocorapy is worth installing for multi-keyword search when you need a pure-Python, platform-independent solution with unicode support and no compiled dependencies. It is actively maintained, has no security vulnerabilities, carries a permissive MIT license, and performs competitively on typical (sparse) text. Install it if C extensions are unavailable or undesirable; if you are searching very dense text with many overlapping matches and latency is critical, a C-based alternative may be faster.

Install

ahocorapy on PyPI

Before you install

Installation is straightforward with no runtime dependencies and low friction. The package is actively maintained with a release 24 days old and has been stable since its first release in 2018.

Tree construction is not thread-safe; concurrent calls to add() have undefined behavior. Finalize the tree before using it in multi-threaded search contexts.

License in practice

MIT license permits unrestricted use, modification, and distribution in both open-source and commercial projects with minimal restrictions.

Quickstart

pip install ahocorapy

from ahocorapy.keywordtree import KeywordTree
kwtree = KeywordTree(case_insensitive=True)
kwtree.add('malaga')
kwtree.add('lacrosse')
kwtree.finalize()
result = kwtree.search('My favorite islands are malaga and sylt.')
print(result)

Verify before relying

  • Whether the library's performance on dense text (0.42s for 100 searches) meets your latency requirements compared to C-extension alternatives.
  • Memory overhead of the suffix-shortcutting optimization relative to other pure-Python implementations in your use case.
  • Whether pickling support for huge keyword trees is tested at the scale your application requires.

Package facts

LicenseMIT permissive
Python supportSupports the current Python release >=2.7
Install frictionLow. Pure-Python wheel
Runtime dependenciesNone
MaintenanceActively maintained 24 days since the last release
Last repo commit
First released
Downloads77,375 / month, #14,530 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 5 - Production/StableIntended Audience :: DevelopersProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python Modules

Evidence: ahocorapy-1.8.0-py2.py3-none-any.whl

Tags

Capabilities
aho-corasick algorithm pythonmulti-keyword searchpattern matching multiple stringsfast substring searchkeyword tree lookupsequence matching algorithmtext search library
Topics
string-matchingalgorithm-implementationpure-python
PyPI keywords
keywordsearchpurepythonaho-corasickahocorasick

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “aho-corasick algorithm python”

  • ahocorapyahocorapy implements the Aho-Corasick algorithm in pure Python to…
  • ahocorasick-rsSearches for multiple substrings in text or bytes using the…
  • flashtextExtracts or replaces keywords in text using the FlashText algorithm,…

Give your agent the search over MCP, or paste the wish link into any chat.

More Python Modules packages

idna Worth it
PyPI · Python Modules · released Jun 2026

Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.

Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.

BSD-3-Clausepure Python · 3.9+
1.8Bdownloads / mo
setuptools Worth it
PyPI · Python Modules · released Aug 2026

Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.

MITpure Python · 3.10+
1.6Bdownloads / mo
PyYAML Worth it
PyPI · Python Modules · released Sep 2025

PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.

MITcompiled wheel · 3.8+
1.2Bdownloads / mo
pydantic Worth it
PyPI · Python Modules · released May 2026

Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.

MITpure Python · 3.9+
1.1Bdownloads / mo
annotated-types Worth it
PyPI · Python Modules · released Jul 2026

Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.

Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…

MITpure Python · 3.10+
871.3Mdownloads / mo
typing-inspection Worth it
PyPI · Python Modules · released Aug 2026

Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.

MITpure Python · 3.10+
783.0Mdownloads / mo

See also ahocorasick-rs · pyahocorasick · textsearch · flashtext · suffix-trees · strsimpy · pylcs · regex · HLL · confusables