Skip to content

The lexicon ​

The lexicon is the set of word lists the filter checks against. It ships with the package, and you can read it through the lexicon library:

dart
import 'package:no_nepali_profanity/lexicon.dart' as lexicon;

lexicon.words.where((e) => e.language == Language.romanized && e.strictness == Strictness.standard);

Entries ​

Every entry has three fields:

dart
class LexiconEntry {
  final String text;             // the word, stem or phrase
  final Language language;       // english, romanized or devanagari
  final Strictness strictness;   // the lowest strictness that turns it on
}

Entries are grouped into three lists, and each list is matched differently:

ListMatched howExample
wordsThe whole word, with or without a postposition.muji catches muji and mujiko, not mujibur.
stemsAny word that starts with the stem.fuck catches fucking and fucker.
phrasesThe words in order, separated by any whitespace.sasto manche catches sasto manche, not sasto ra manche.

Two more lists hold the postpositions that are removed before a whole-word check: latinSuffixes (ko, lai, haru…) and devanagariSuffixes (को, लाई, हरू…).

Languages ​

LanguageContains
EnglishEnglish profanity and insults.
RomanizedNepali written in Latin letters, and Hindi slang common in Nepal.
DevanagariAnything written in Devanagari.

Strictness levels ​

StrictnessContains
LenientSevere profanity, sexual terms and slurs.
StandardMilder insults that some sites allow, like idiot, murkha, sala and sasto manche.
StrictEntries that are offensive but are also ordinary words, like damn and prick, and stems that start ordinary words or names, like rand and cond. The names and words those stems hit most, like Randip and conditions, are on a built-in allow list.

A filter set to one level uses the entries at that level and every level below it.

What's deliberately left out ​

  • Words that are also common names, or the start of names, unless they're whole words that can't be a name.
  • Caste names and surnames. A word list can't tell a slur from someone's name.
  • Everyday words that are only insulting in context, like fohor (dirty), lato (mute) or kukur (dog).

To suggest additions or removals, see Contributing.

Flat lists ​

For convenience, the library also has plain List<String> lists of every entry in one script, at every strictness: latinWords, latinStems, latinPhrases, devanagariWords, devanagariStems and devanagariPhrases.