Giter Site home page Giter Site logo

bruk3 / obscenity-filter Goto Github PK

View Code? Open in Web Editor NEW
9.0 2.0 2.0 935 KB

An obscenity filter library for the Amharic language

Home Page: https://bruk3.github.io/obscenity-filter/

License: MIT License

JavaScript 100.00%
filter obscenity obscene profanity-detection bad-word-filter bad-words swear-filter swearing-detector swear amharic

obscenity-filter's Introduction

obscenity-filter

What is it?

A javascript library that detects obscene Amharic words and phrases.

An obscenity filter library for the Amharic langauge.

GitHub GitHub Workflow Status (branch) nycrc config on GitHub Read the Docs


A variety of public facing social websites process input texts from users in order to display it in public. These websites usually:w utilize a profanity filtering service in order to avoid exposing the public from extremely obscene phrases. Unfortunately, most of the filtering packages only have support for a few languages. Amharic, the official language of Ethiopia with more than 20 million speakers worldwide, has not been one of the supported languages. At least not until obscenity-filter.

Usage

Check if an Amharic word is obscene or not

const OFilter = require('obscenity-filter');
const filter = new OFilter(true)

console.log(filter.isPure('hello')); // true 
console.log(filter.isPure('ብድሬን')); // true
console.log(filter.isPure('ብድ'));  // false

Scrub all obscene words and replace them with asterisk characters.

const rawPhrase = 'አንዳንድ ሰዎች በማህበራዊ ገጽ ላይ እየገቡ ብዳታም እያሉ ይሳደባሉ';
const cleanedPhrase = 'አንዳንድ ሰዎች በማህበራዊ ገጽ ላይ እየገቡ **** እያሉ ይሳደባሉ';

filter.scrub(rawPhrase); // returns cleanedPhrase

Get the labels for an obscene word

filter.getLabels('ልብዳቹ'); // returns [PN, IN] [pornographic, insulting]

Add new words to the set of obscenity words

const newBadWords = ['ግማታም', 'ጥንባታም'];
filter.addWords(newBadWords, [['IN'], ['IN']]);

filter.addWords(['OTHER_BAD_WORD'], []) // Uses the label NO (NONE) as the default label.

Remove words from the set of obscenity words

filter.isPure('ቅምጥ') // false
filter.removeWords(['ቅምጥ']);
filter.isPure('ቅምጥ') // true

obscenity-filter's People

Contributors

bruk3 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

obscenity-filter's Issues

Load new words from file

Take an optional filename parameter in the constructor and load the words in that file so that the collection of obscene Amharic words can customizable by the library user.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.