A javascript library that detects obscene Amharic words and phrases.
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.
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
const rawPhrase = 'አንዳንድ ሰዎች በማህበራዊ ገጽ ላይ እየገቡ ብዳታም እያሉ ይሳደባሉ';
const cleanedPhrase = 'አንዳንድ ሰዎች በማህበራዊ ገጽ ላይ እየገቡ **** እያሉ ይሳደባሉ';
filter.scrub(rawPhrase); // returns cleanedPhrase
filter.getLabels('ልብዳቹ'); // returns [PN, IN] [pornographic, insulting]
const newBadWords = ['ግማታም', 'ጥንባታም'];
filter.addWords(newBadWords, [['IN'], ['IN']]);
filter.addWords(['OTHER_BAD_WORD'], []) // Uses the label NO (NONE) as the default label.
filter.isPure('ቅምጥ') // false
filter.removeWords(['ቅምጥ']);
filter.isPure('ቅምጥ') // true