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!'