Skip to main content

A software that uses an curated open-source keyword list to detect hate.

Project description

PyPI version Supported Python versions CircleCI

Red Flagger Word Catcher 🙅🚩

A simple, dependency-free software that does keyword-based abuse flagging. It is designed with a philosophy of sensitivity and a focus on recall rather than precision. It detects from a term list that contain terms that are discovered through lexicons and corpora containing hate speech, chatbot system abuse, toxicity, violence, and/or general profinity/obscenity.

🚨🚨 Important Note on Keyword Detection Systems 🚨🚨

We highly discourage the use of keyword systems as the only line of defense for toxicity and/or abuse detection. Problems associated with keyword detection systems range from performance issues to socially harmful false positives in cases like reclaimation. This system is encouraged to be used in conjunction with a review process and/or a stronger classification systems such as a deep learning model.

Examples of suggested, more robust use cases:

  • Keyword detection as part of an ensemble.
  • Keyword detection -> Deep learning classification on positives (Useful when there's a lot of data and not a lot of compute).
  • Using detected keywords as BOW features and then training classical models on said features.

For performance, see evaluation/.

Usage 🔨

For basic usage, all you have to do is:

$ pip install rfwc

from rfwc import RedFlagger

rf = RedFlagger()
document = "Something hateful"
hate_words = rf.detect_abuse(document)

There's also a method to get a bag-of-words from the wordlist:

...

hate_bow = rf.get_abuse_vector(document)

The library is designed to work with other word lists that are not built-in to the library. This can be managed with the add_words and remove_words methods. To get the current word list, there is the get_wordlist method.

Directory 📁

  • abuse_flagger/ contains the package code and the main logic.
  • data_building/ contains the code and documentation of how the initial dataset was created.
  • evaluation/ contains the evaluation of the keyword system on the test splits of the corpora used to discover the keywords.

Dataset Obscurity 😶‍🌫️

The word list is obscured as a base16 representation of the list of hate words. We did not feel comfortable exposing this list and we discourage any non-base16 representations of the wordlist being uploaded elsewhere. For details on dataset creation, see README.md in data_building/.

Other Resouces 📚

We acknowledge that there are other great resources and link some of them below:

Contributions 🤝

We welcome contributions for both the word list and the software using a fork-and-pull model. For additions to the word list, please ensure there are no duplicates or overlaps and that the additional data is obscured in base16. For any new features for the RedFlagger, open an issue for discussion first before opening a pull request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rfwc-0.1.2.tar.gz (34.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rfwc-0.1.2-py3-none-any.whl (33.4 kB view details)

Uploaded Python 3

File details

Details for the file rfwc-0.1.2.tar.gz.

File metadata

  • Download URL: rfwc-0.1.2.tar.gz
  • Upload date:
  • Size: 34.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for rfwc-0.1.2.tar.gz
Algorithm Hash digest
SHA256 2b66c6fb4ecadd49070a7683852626ac98dbcf62ab8b585fe10826203a03b0bd
MD5 e91d1d5d7479d9534e1a7b6580990511
BLAKE2b-256 1c6da0f242dfe25155f02806913083f3608dc5ad44a266b5ce12838fdc9b7fe8

See more details on using hashes here.

File details

Details for the file rfwc-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: rfwc-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 33.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for rfwc-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2e8bb9ee9123e49628762bfc4c23bbce06faf2933c5d3777ae2ef86cfe03f905
MD5 be6ffca3148e309afdd72c775b02a6b0
BLAKE2b-256 14911c4eac5173c5fe110cd3e2d5011dd13835825e154b6331c7571a11d169f9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page