dictionary profanity filter
1.0.0
وحدة بيثون لتصفية الألفاظ النابية باستخدام القواميس. وهو يدعم اللغات الإنجليزية والروسية خارج الصندوق.
استخدم الأمر التالي لتثبيت الحزمة باستخدام 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!'