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:
| List | Matched how | Example |
|---|---|---|
words | The whole word, with or without a postposition. | muji catches muji and mujiko, not mujibur. |
stems | Any word that starts with the stem. | fuck catches fucking and fucker. |
phrases | The 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
| Language | Contains |
|---|---|
| English | English profanity and insults. |
| Romanized | Nepali written in Latin letters, and Hindi slang common in Nepal. |
| Devanagari | Anything written in Devanagari. |
Strictness levels
| Strictness | Contains |
|---|---|
| Lenient | Severe profanity, sexual terms and slurs. |
| Standard | Milder insults that some sites allow, like idiot, murkha, sala and sasto manche. |
| Strict | Entries 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.