亵渎过滤器,基于Shutterstock字典

leoprofanit的Python项目详细描述


豹纹

TravisPyPI version fury.ioPyPI licensePyPI pyversions

Python版本的leo-profanity,“Shutterstock”基于字典的过滤器。在

安装

pip install leoprofanity

# or
git clone https://github.com/jojoee/leo-profanity-python
cd leo-profanity-python
python setup.py install

使用

CLI

^{pr2}$

Python

fromleoprofanityimportLeoProfanity# example usagefil=LeoProfanity()fil.check("I have BoOb, etc.")# Truefil.clean("I have BoOb, etc.")# 'I have ****, etc.'# return all profanity words (List[str])fil.list()# remove word form the listfil.remove_word("boob")# check whether the string contains profanity word or notfil.check("Buy classic watches online")# Falsefil.check("I have BoOb.")# True# clean or replace profanity word in a stringfil.clean("I have boob, etc.")# "I have ****"fil.clean("I have boob,boob, ass, and etc.")# "I have ****,****, ***, and etc."fil.clean("I have boob","+")# "I have ++++"fil.clean("Buy classic watches online")# "Buy classic watches online"# add new word(s)fil.add("b00b")fil.add(["b@@b","b##b"])# remove word(s) from the listfil.remove("boob")fil.remove(["boob","boobs"])# reset word list by using en dictionaryfil.reset()# remove all words inside an existing listfil.clear_list()# return word list from dictionaryfil.get_dictionary()# returns "en" word listfil.get_dictionary("en")# reset word list by using en dictionaryfil.load_dictionary()fil.load_dictionary("en")

贡献

# env
conda env list
conda create --name leoprofanity python=3.7

# test
python -m unittest tests/*.py # run unit test

# format
flake8 --max-line-length=120 --exclude=__*.py
black . --check
pytype ./leoprofanity

# publishing
pip install twine # package for publishing
python setup.py sdist bdist_wheel # build the package
tar tzf dist/leoprofanity-0.0.1.tar.gz # check published file in the published package
twine check dist/* # if the package render correctly
python -m pip install dist/leoprofanity-0.0.1-py3-none-any.whl # for testing, install local to global
python -m leoprofanity "I have boob, etc." # testing the package via cli
twine upload --repository-url https://test.pypi.org/legacy/ dist/* --verbose # publishing (test)
twine upload dist/* # publishing
pip install leoprofanity -U # force update module to test after publishing

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

推荐PyPI第三方库


热门话题
javaelk:如何在Kibana中按异常类对stacktrace进行分组   java两个组件使用MigLayout相互重叠   java Hibernate标准获取关联实体的列表,而不是父实体的列表   从Java关闭另一个应用程序,但不是由当前Java应用程序启动   java使用OGNL获取参数   java如何在SSLEngine中启用密码TLS\U DHE\U RSA\U和\U AES\U 256\U GCM\U SHA384   在Java中有效地比较两个列表<Object[]>   java杀死挂起的线程   在java中从指定模式前后的字符串中提取子字符串   存储整数的java HashMap替代方案   java如何使用LibGDX加载特定于语言的资产?   java如何使用JSON响应从维基百科读取结构化数据   java无法连接到Spark Master:原因是:[已解除关联]   java如何配置Elastic beanstalk classic负载平衡器以使用CLI终止HTTPS   java筛网中的奥斯汀大于int   java PircBot在每个用户上迭代一组命令   java将带有Jackson的hashmap编组为XML的错误结构   testng中的java设置testfailure给出了正回报   java如何在IntelliJ中正确配置Eclipse项目?