dictionary profanity filter
1.0.0
Модуль Python для фильтрации ненормативной лексики с использованием словарей. Он поддерживает английские и русские языки вне коробки.
Используйте следующую команду для установки пакета с помощью PIP:
pip install dictionary-profanity-filterВот несколько примеров использования модуля:
from dictionary_profanity_filter import ProfanityFilter
profanity_filter = ProfanityFilter () profanity_filter . add_words ([ 'censorship' , 'blocking' ])
profanity_filter . censor ( 'I hate censorship and blocking!' )
# Output: 'I hate ********** and ********!' profanity_filter . is_clean ( 'Porn is a restricted word' )
# Output: False profanity_filter . remove_word ( 'blocking' )
profanity_filter . censor ( 'I hate censorship and blocking!' )
# Output: 'I hate ********** and blocking!'