python亵渎过滤器

dictionary-profanity-filter的Python项目详细描述


字典亵渎过滤

Build StatusPyPI version

用于使用字典进行亵渎过滤的python模块。 它支持现成的英语和俄语。

要求

  • python 3.5或更高版本

如何安装

使用以下命令使用pip安装软件包:

pip install dictionary-profanity-filter

如何使用

下面是模块使用的几个示例:

  • 创建亵渎过滤器实例:
fromdictionary_profanity_filterimportProfanityFilterprofanity_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!'

待办事项

  • []编写文档
  • [X]编写测试

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java Springboot数据JPA findByDate()   java是否可以有多个顶级树节点?   javahibernatehql。子查询中的多个   使用Twilio验证java Keyclope电话号码   java重写对象的toString()表示返回意外的符号   java Android最多每15分钟调用一个方法,否则使用保存的数据   在java swing中突出显示jeditorpane中的一些单词   java将时间戳转换为UTC时区   由于main中存在ArrayIndexOutOfBoundsException,导致java编译错误   java如何通过requestscope获取对象内部对象的值?   java访问安卓代码内的网站并检索生成的图像   java这种日期格式的模式是什么?   java解析包含超链接的xml字符串