1.0.0 • Published 3 years ago

@dsojevic/profanity-list v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Profanity List

This repository contains highly consumable lists of words and/or phrases that may be considered profane or inappropriate. The profanity lists come in two forms: JSON format that contains the words and phrases with associated meta information and a plain text format that contains one word or phrase per line.

Please note that most entries in the JSON lists have started their life with a Severity Level of 3 (Strong) prior to any solid classification - this is not necessarily an accurate reflection of the common severity level of any of these words or phrases. Contributions are more than welcome to adjust these levels to bring them more in line with what you may expect.

Languages

NameCodeJSONPlain TextMeta
Englishenen.jsonen.txt434 profanities, 809 matches, 6 tags
Emojiemojiemoji.jsonemoji.txt7 profanities, 18 matches, 2 tags

Available Tags

NameCodeTags
Englishengeneral
lgbtq
racial
religious
sexual
shock
Emojiemojigeneral
sexual

JSON Format

The JSON format has a top level array containing objects with the following structure:

PropertyRequired?Description
idYString in lowercase characters used as a unique ID for the profanity.
matchYString in lowercase characters. Asterisks (*) can be used to indicate the previous character can have one or more appearances. Pipes (\|) can be used as a separator if matching multiple terms under this profanity.
severityYInteger from 1 to 4 corresponding to a supported Severity Level.
tagsNAn array of lowercase strings to indicate how this profanity is tagged. These should be in English.
allow_partialNBoolean value. Whether or not this profanity should be used with partial matching. Explicitly set to false when the match may otherwise have hundreds or thousands of exceptions.
Implementations should default to true if no attribute is present. (ie. the profanity can be used in partial matching)
exceptionsNAn array of lowercase strings indicating exceptions to this profanity if using partial matching. An asterisk (*) is used as a placeholder for the matched word.
Example: sp* would be a valid exception ('sparse') for the profanity arse if relying on partial matching._

Severity Levels

ValueSeverity
1Mild
2Medium
3Strong
4Severe

Example Data Structure

[
  {
    "id": "plain-text",
    "match": "plain text",
    "severity": 1,
    "tags": ["insults", "anti-computer"],
    "exceptions": ["unusually *", "very *"]
  },
  {
    "id": "multiple-matches",
    "match": "multiple|multipal",
    "severity": 2,
    "tags": ["functionality"]
  },
  {
    "id": "elongated-words",
    "match": "lo*ng",
    "severity": 3,
    "tags": ["long-words"],
    "exceptions": ["*ing"]
  },
  {
    "id": "exact-match-only",
    "match": "en",
    "severity": 1,
    "tags": ["exact-words"],
    "partial_match": "false"
  }
]

Example Matching

Profanity IDSentenceShould Match?Comment
plain-textI like plain text!YExact match
plain-textI generally do plain texting.YPartial match
plain-textUnusually plain text is weird...NPart of an exception
plain-textYou have very plain text.NPart of an exception
plain-textPlain old sentence with textNNot found at all
multiple-matchesThere are multiple ways to match.YExact match on first match option
multiple-matchesI can spell multipal just fine, thx.YExact match on second match option
multiple-matchesI'm using the word many instead...NNot found at all
elongated-wordsThis is a long word.YExact match
elongated-wordsSuch a looooong wait!YMatch on repeating 'o'
elongated-wordsI am longing for some foodNPart of an exception
elongated-wordsShort words are the best!NNot found at all
exact-match-onlyThe language of this is enYExact match
exact-match-onlyEnsure I send a pencil to the agency.NPartial matching disallowed/discouraged

Plain Text Format

The plain text format contains one word or phrase per line and does not include any meta information on the matching such as asterisks to indicate one or more characters matched.

Example Data Structure

plain text
long
multiple
multipal

Node Modules

List / Data Package

This package is available as an NPM package for use in JS projects.

NPM installation:

npm install @dsojevic/profanity-list

Yarn installation:

yarn add @dsojevic/profanity-list

Contributing

Contributions to the profanity lists are welcome. As profanities are subjective by nature, please use your best judgement when it comes to adding to or updating these lists.

The source of truth for these lists is located in the JSON files in the src directory. The top level language files should be built from these source files using the ./bin/build.js command.

Adding Profanities

Adding new profanities to the lists and adding new lists for other languages are both highly encouraged. Please

Removing Profanities

Removal of items is discouraged - if you feel strongly that an item isn't profane or doesn't belong, it is preferred that you instead adjust the severity level of the item and/or update the tags associated with it. This allows consumers of the JSON formats to make those decisions for themselves.

Managing Tags

It is preferred that the number of tags used overall is kept relatively small in this data set so as to not overwhelm the choices required by a consumer. Please open an issue to propose any new tags so it can be made open for discussion.

Tag usage should be kept consistent from language to language. Some cases may warrant a language (or set of languages) having a small number of tags that are only applicable to them, though this should only be for exceptional circumstances.

Severity Levels

As noted in the introduction, the default severity level for items in this list is 3 (Strong) as a starting point. Contributions that adjust these to levels that better reflect their severity are more than welcome. For example, if you believe an item is only mildly offensive to the common person, it can be downgraded to 1 (Mild) -- conversely, if you think it is even more offensive it can be upgraded to 4 (Severe).


Copyright (c) 2021 David Sojevic