universal-profanity
Universal Profanity is a versatile library designed for the detection and filtration of
profanity across a wide range of languages. The library cover 25 languages.
- Full text or individual words censoring.
- Multilingual support, including profanity filtering in texts written in mixed languages.
- Partial word censoring.
- There are 25 popular languages to work with.
Here are the basic examples of how to use the library. For more examples please see tests
folder.
from universal_profanity.profanity import UniversalProfanity
pf = UniversalProfanity()
pf.censor('Shit, I fucked up')
# !*@^, I $#%@!$ up
pf.contains_profanity('Fck dude')
# True
from universal_profanity.profanity import UniversalProfanity
pf = UniversalProfanity(country='en', replace_chars='*')
pf.censor('Shit, that is bullshit!')
# ****, that is ********!
pf = UniversalProfanity(country=['en', 'ru'], replace_chars='*#')
pf.censor('ะะปั ั fuck that shit')
# #** ั #*## that **#*
from universal_profanity.profanity import UniversalProfanity
pf = UniversalProfanity()
pf.set_censor_characters('$')
pf.censor("That's bullshit!")
# "That's $$$$$$$$!"
First two parts of installation instructions are designed for the users who want to filter English profanity. If you want to filter profanity in another language you still need to read it.
You need to install universal-profanity
:
$ pip install universal-profanity
- th - Thai ๐น๐ญ
- fr - French ๐ซ๐ท
- uk - Ukrainian ๐บ๐ฆ
- gr - Greek ๐ฌ๐ท
- ge - German ๐ฉ๐ช
- cz - Czech ๐จ๐ฟ
- sp - Spanish ๐ช๐ฆ
- bu - Bulgarian ๐ง๐ฌ
- tc - Tchinese ๐จ๐ณ
- da - Danish ๐ฉ๐ฐ
- po - Polish ๐ต๐ฑ
- en - English ๐ด๓ ง๓ ข๓ ฅ๓ ฎ๓ ง๓ ฟ
- br - Brazilian ๐ง๐ท
- du - Dutch ๐ณ๐ฑ
- fi - Finnish ๐ซ๐ฎ
- no - Norwegian ๐ณ๐ด
- in - Indonesian ๐ฎ๐ฉ
- ja - Japanese ๐ฏ๐ต
- tu - Turkish ๐น๐ท
- ru - Russian ๐ท๐บ
- ro - Romanian ๐ท๐ด
- sc - Schinese ๐จ๐ณ
- it - Italian ๐ฎ๐น
- ko - Korean ๐ฐ๐ท
- sw - Swedish ๐ธ๐ช
- vi - Vietnamese ๐ป๐ณ
- hu - Hungarian ๐ญ๐บ
- la - Latam