@kpachbiu/censure-js
Version:
Dirty russian/english words filter
53 lines (52 loc) • 1.64 kB
TypeScript
/**
* //////////////
* // CENSURE //
* ////////////
*
* Dirty words - filter.
*
* A JavaScript lib to filter out dirty, vulgar, obscene, profane words in russian or english texts.
*
* Key features:
* - Find profanity (in Russian and English texts) and hide it with *** symbols.
* - Find profanity (in Russian texts) and replace it with normative vocabulary.
*
* Some examples:
* isBad('Original text with abusive words'); // return: bool
* replace('Original text with abusive words'); // return: string (text without abusive words)
* fix('Original phrase with abusive words'); // return: string (fixed text)
*
* @author jzavorohina@yandex.ru
*
* List of replacements partly - by the book "Русский мат.Толковый словарь." Составитель Ахметова Т.В., Москва "КОЛОКОЛ-ПРЕСС", 2000
*
*/
declare class Censure {
REPLACEMENT: string;
/**
* Searches if there any abusive words in the text
*
* @param {String} string - original text
* @return {Boolean} - is there any abusive words in our string
*/
isBad(string: string): boolean;
/**
* Replace abusive words from string
*
* @param {String} string - original text
* @return {String} - cleaned text
*/
replace(string: string): string;
/**
* Fixing abusive words inside string
*
* @param {String} string - original text
* @return {String} - fixed text
*/
fix(string: string): string;
private prepare;
private getPatterns;
private checkFirstChar;
private upFirstChar;
}
export default Censure;