Skip to content

๐Ÿคฌ Library for detecting and filtering profanity

License

Notifications You must be signed in to change notification settings

mbalashovv/universal-profanity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

universal-profanity: A Python library for detecting and filtering profanity

Overview

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.

Features

  1. Full text or individual words censoring.
  2. Multilingual support, including profanity filtering in texts written in mixed languages.
  3. Partial word censoring.
  4. There are 25 popular languages to work with.

Usage

Here are the basic examples of how to use the library. For more examples please see tests folder.

Basics

from universal_profanity.profanity import UniversalProfanity

pf = UniversalProfanity()
pf.censor('Shit, I fucked up')
# !*@^, I $#%@!$ up

pf.contains_profanity('Fck dude')
# True

More options

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 **#*

Customizations

from universal_profanity.profanity import UniversalProfanity

pf = UniversalProfanity()

pf.set_censor_characters('$')
pf.censor("That's bullshit!")
# "That's $$$$$$$$!"

Installation

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.

Basic installation

You need to install universal-profanity:

$ pip install universal-profanity

Available country codes

  • 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

About

๐Ÿคฌ Library for detecting and filtering profanity

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages