Profanity Detection

Gauri Guglani
3 min readAug 3, 2022

--

Today while browsing through different packages I came across this very useful and interesting python package and thought to share it with you all. So, let us begin and understand what exactly it is!

source: google

What is a package?

A python package is a collection of various modules like we collect all the folders and pack them in a box. Now, you might be thinking what is a module? A Module is the inclusion of classes, functions, variables, etc so that we can just directly use them instead of writing the whole code again, and then when we combine all the modules, it becomes a package.

Profanity Package

As you already know the title is Profanity Detection, so for that, we are going to use the package called “better-profanity”. Before that let us understand what is profanity detection.

  1. Profanity detection is used to check the language of the text. Language refers to whether the text is abusive, cursing, negative text, etc.
  2. If a negative or abusive text/word is mentioned in any sentence, it just blurs with “***”.
  3. This is a good method for censoring socially offensive language
  4. let us see an example of how it is used while coding.

a. We need to 1st install the package which is better_profanity and the code is “pip install better_porfanity”

b. Importing a profanity module from package better_profanity

c. Next step is to enter the text for which you wanna check the profanity.

d. We will create one variable to censor the abusive text and then with the help of profanity. From the Profanity Package, we need to access the method censor for that we will be using dot notation. So, profanity.censor() will be used to check the words from the entered text.

e. Then finally, we will be printing our variable censored to know the censored text.

In this way, with the help of python package profanity, we can censor the abusive language from a text.

Applications of Profanity Detection

  1. We can filter out the spam, abusive, and foul language from any content or website and make them user-friendly.
  2. Social media websites/apps are a great example where we can use profanity to filter out abusive content.
  3. Twitter can apply this to its algorithm to avoid the use of foul language in the tweets.

--

--

Gauri Guglani
Gauri Guglani

Written by Gauri Guglani

Data Science |Technology |Motivation | Reader | Writer | Foodie| YT- https://www.youtube.com/@GauriGuglani

No responses yet