Skip to content

A repository in npm package in typescript for profanity checking in English , Hindi , German , Spanish , Italian and French

License

Notifications You must be signed in to change notification settings

DevJSter/clean-speech

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

clean-speech-hindi

Author: Shubham Tiwari

This is a small Node.js module for dealing with profanity by removing , masking or adding new ones in the dictionaries in English , Hindi , german , Spanish , French and Italian. This module has functionalities for detecting bad words and cleaning them.

Technologies used: Node.js, TypeScript

Installation

Run the following command:

npm install @devshubham/clean-speech-hindi

Requirements

It internally uses lodash, which will be automatically installed.

Code Example

import profanity from '@devshubham/clean-speech-hindi';

const maskBadWords = () => {
  const message = "hi asshole you are a bitch chutiya... ";
  const cleaned = profanity.maskBadWords(message);
  console.log(cleaned); // hi ******* you are a ***** ******* ....
}

const isMessageDirty = () => {
  const message = "hi asshole you are a bitch chutiya";
  const isDirty = profanity.isMessageDirty(message);
  console.log(isDirty); // true

  const cleanMessage = "hi there. How are you";
  const isClean = profanity.isMessageDirty(cleanMessage);
  console.log(isClean); // false
}

const addWords = () => {
  const newWords = ["this", "dumbness"];
  const updatedDictionary = profanity.addWords(newWords); 
  // this will add the new words to the dictionary of bad words.
  // This function optionally returns the entire dictionary of bad words.
  console.log(updatedDictionary);
}

const removeWords = () => {
  const wordsToRemove = ["this", "dumbness"];
  const updatedDictionary = profanity.removeWords(wordsToRemove); 
  // This will remove the words from the dictionary of bad words.
  // This function optionally returns the entire dictionary of bad words.
  console.log(updatedDictionary);
}

Contributors

Shubham Tiwari

License

MIT License

About

A repository in npm package in typescript for profanity checking in English , Hindi , German , Spanish , Italian and French

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published