{"categories":[{"label":"Python Modules","url":"https://skillfed.io/packages/category/software-development-libraries-python-modules/20"},{"label":"Utilities","url":"https://skillfed.io/packages/category/utilities/10"}],"enrichment":{"capability":"Builds efficient Trie-based regex patterns for fast matching and replacing strings in bulk, avoiding the performance penalty of simple regex unions on large word sets.","skillfed_tags":["text-processing","regex-optimization","data-filtering"],"use_cases":["Filter spam or profanity from user-generated text by maintaining a blacklist of forbidden terms.","Extract only whitelisted keywords or entities from documents for data cleaning pipelines.","Perform bulk find-and-replace operations (e.g., synonym substitution, URL rewriting) in a single pass.","Build content moderation systems that need to match many patterns efficiently without regex compilation overhead.","Normalize or standardize text by replacing multiple variant spellings or abbreviations with canonical forms."],"what_it_does":"Retrie solves the performance problem of matching or replacing large sets of strings using naive regex unions. Instead of compiling a pattern like `(?:abc|abs|foo)` which becomes slow as the word list grows, it builds a Trie data structure that produces a more efficient pattern like `(?:ab[cs]|foo)`. The package provides three main classes\u2014Trie (the underlying structure), Blacklist (filter out unwanted strings), Whitelist (keep only allowed strings), and Replacer (perform bulk find-and-replace)\u2014each with options to match whole words or substrings.\n\nThe implementation is pure Python with minimal dependencies (only typing and cached-property), making it portable and easy to integrate. It supports both Python 2.7 and modern Python versions, and has been actively maintained since its 2020 release. The API is straightforward: instantiate a class with a word list or mapping, optionally configure matching behavior, and call methods like `filter()`, `cleanse_text()`, or `replace()` on your input.","worth_installing":"Yes. Retrie is a focused, well-maintained tool that solves a real performance problem for bulk string matching and replacement. Its low install friction, permissive MIT license, and broad Python version support make it a safe dependency. Use it when you need to filter or replace large word sets and regex performance matters; skip it if you only have a handful of patterns to match."},"id":"retrie","links":{"html":"https://skillfed.io/packages/retrie","md":"https://skillfed.io/packages/retrie.md","pypi":"https://pypi.org/project/retrie/"},"maintenance":{"status":"active"},"meta":{"latest_release":"2024-02-22","license_spdx":null,"license_treatment":"permissive","name":"retrie","python_support":"supports_current","summary":"Efficient Trie-based regex unions for blacklist/whitelist filtering and one-pass mapping-based string replacing"},"popularity":{"monthly_downloads":101490,"position":12931,"tier":"top_15000"},"security":{"n_vulnerabilities":0},"version":"0.3.1"}
