Repository navigation
3.1.1
Changelog
All notable changes to this project will be documented in this file.
[3.1.1] - 2026-01-13
Refactoring (Architecture 3.0)
- Modularization: Split monolithic
keyword.pyinto distinct responsibilities:flashtext/keyword.py: High-level API and facade.flashtext/trie_dict.py: Data structure operations (pure functions).flashtext/utils.py: Algorithms (Levenshtein) and helper utilities.
- Utils: Extracted
extract_sentencesandlevenstheintoutils.pyto reduce class weight.
Performance
- Loop Optimization: Optimized
extract_keywordshot loop by caching member variables and reducing object creation overhead. - Benchmark: Performance restored to ~0.27s (Case-Sensitive) / 0.29s (Case-Insensitive) on standard corpus.
- Reverted: "Internationalized Word Boundaries" (Issue #4) reverted due to 3.5x performance regression. This feature is reopened for future optimized implementation.
Added
- Mixed Case Support: Added ability to mix case-sensitive and case-insensitive keywords in the same processor.
- Implemented via Multi-Edge Trie (Space-for-Time), removing runtime
lower()calls.
- Implemented via Multi-Edge Trie (Space-for-Time), removing runtime
- Fuzzy Matching Support: Added
max_costparameter to support Levenshtein distance matching (including CJK support). - Keyword Count API: New
len(keyword_processor)support to get total unique terms. - Replacement Metadata:
replace_keywordsnow supportsspan_info=Trueto return detailed replacement records. - Sentence Extraction: New
extract_sentences()API to find sentences containing keywords. - Clean Name Mapping:
add_keywordnow accepts a list of clean names (Issue #11).
Fixed
- CJK Support: Fixed adjacent keyword extraction for Chinese/Japanese/Korean text (Issue #1).
- Unicode Spans: Fixed inaccurate span positions when handling Unicode characters that change length during case folding (Issue #2).
- Edge Cases:
- Platform: Verified Linux aarch64 support (Pure Python).
Documentation
- Added
CONTRIBUTING.mdwith strict performance guidelines. - Added
benchmark.pyfor standardized performance testing. - Updated
README.mdwith new features and benchmark results.