skillfed

flashtext

Extract/Replaces keywords in sentences.

flashtext v2.7 2.6M downloads/30d#3,000 on PyPI5,714
Permissive license AGING released

What it is and what it does

FlashText is a keyword extraction and replacement library that implements a specialized algorithm optimized for finding and replacing multiple keywords in text. Instead of using regex, it builds on Aho-Corasick and Trie data structures to achieve faster performance, especially when working with large keyword dictionaries or processing many documents. The library lets you add keywords with optional clean-name mappings, extract them from text with position information, or replace them with substitutes. It also supports case-sensitive matching, custom word boundaries, and bulk keyword operations via dictionaries or lists.

The package has no external runtime dependencies and works as a pure Python implementation. However, it requires compilation during installation and has not received updates since early 2018, though the repository remains accessible. The classifiers indicate support for Python 2.7, 3.5, and 3.6, but actual compatibility with modern Python versions is unclear.

Use it for:

  • Extract named entities or domain-specific terms from documents at scale faster than regex-based approaches.
  • Replace product names, abbreviations, or aliases with canonical forms in bulk text processing pipelines.
  • Build keyword-based text classification or tagging systems where you need to match many terms efficiently.
  • Normalize variations of terms (e.g., 'Big Apple' → 'New York') across large document collections.
  • Detect and extract keywords with associated metadata (e.g., category labels) from unstructured text.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Extracts or replaces keywords in text using the FlashText algorithm, which is based on Aho-Corasick and Trie data structures and designed to be faster than regex for bulk keyword operations.

Yes, if you need fast keyword extraction or replacement on modern Python and can verify compatibility. The algorithm is sound and the library is widely used (2.5M+ monthly downloads), but the lack of updates since 2018 and high install friction (source build required) mean you should test it on your target Python version first. No known security vulnerabilities. Consider it a stable, specialized tool rather than an actively maintained package.

Install

flashtext on PyPI

pip

pip install flashtext

uv

uv add flashtext

poetry

poetry add flashtext

Installing flashtext

Before you install

Installation requires building from source (high friction). The package has not been updated since February 2018, though the repository remains active with recent commits as of April 2025. Maintenance is aging but not abandoned.

License in practice

Licensed under MIT (permissive), which allows commercial and private use with minimal restrictions.

Quickstart

from flashtext import KeywordProcessor
kp = KeywordProcessor()
kp.add_keyword('Big Apple', 'New York')
kp.add_keyword('Bay Area')
keywords_found = kp.extract_keywords('I love Big Apple and Bay Area.')
# Returns: ['New York', 'Bay Area']

No runtime dependencies, but package requires building from source during installation.

Verify before relying

  • Current Python 3 compatibility beyond the stated 3.5 and 3.6 support (classifiers are from 2018).
  • Whether the package works reliably with modern Python versions given the age of the last release.

Package facts

License not declared (permissive)
Python support not specified
Install friction high — source build required
Runtime dependencies none
Maintenance aging — 3,101 days since the last release
Last repo commit
First released
Downloads 2,560,496/month — #3,000 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: flashtext-2.7.tar.gz

Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 2.7Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6

Tags

keyword extraction from textkeyword replacement in sentencesfast text pattern matchingaho-corasick keyword searchbulk keyword find and replacetrie-based text processingregex alternative for keywords
text-processingpattern-matchingnlp-utility

More Text Processing packages