Skip to main content

A small module meant for use in text generators that lets you filter strings for bad words.

Project description

# wordfilter

A small module meant for use in text generators that lets you filter strings for bad words.

## Getting Started
Install the module with: `npm install wordfilter`

```javascript
var wordfilter = require('wordfilter');
wordfilter.blacklisted('does this string have a bad word in it?'); // "false"

// clear the list entirely
wordfilter.clearList();

// add new words
wordfilter.addWords(['zebra','elephant']);
wordfilter.blacklisted('this string has zebra in it'); // "true"
```

## Documentation
This is a word filter adapted from code that I use in a lot of my twitter bots. It is based on [a list of words that I've hand-picked](https://github.com/dariusk/wordfilter/blob/master/lib/badwords.json) for exclusion from my bots: essentially, it's a list of things that I would not say myself. Generally speaking, they are "words of oppression", aka racist/sexist/ableist things that I would not say.

The list is not all-inclusive, and I'm always adding words to it. If you'd like to file an issue or a pull request to add more words, please do so, but understand that this is primarily for use in my own projects, and I may not agree to add certain words. (For example, I have no problem with scatological words, so "shit" and "fuck" will never be on this list.)

Words are case insensitive.

Also note that due to the complexities of the English language, I am considering anything containing the substring of a bad word to be blacklisted. For example, even though "homogenous" is not a bad word, it contains the substring "homo" and it gets filtered. The reason for this is that new slang pops up all the time using compound words and I can't possibly keep up with it. I'm willing to lose a few words like "homogenous" and "Pakistan" in order to avoid false negatives.

## Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/).

## License
Copyright (c) 2013 Darius Kazemi
Licensed under the MIT license.

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

wordfilter-0.1.9.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

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

wordfilter-0.1.9-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file wordfilter-0.1.9.tar.gz.

File metadata

  • Download URL: wordfilter-0.1.9.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for wordfilter-0.1.9.tar.gz
Algorithm Hash digest
SHA256 1e25f04d55046ae363b63814da6cdec5aff33e229a01a28291822bb99d54058a
MD5 db77a200176f0e6a505444dac4740125
BLAKE2b-256 26ee2ed7e51a78fac0742bbc69a8f721aec69337cc4e1baf494873ebf33df968

See more details on using hashes here.

File details

Details for the file wordfilter-0.1.9-py3-none-any.whl.

File metadata

File hashes

Hashes for wordfilter-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 a8552d82a6c6df8b12db080ce2d45df356943e88902e600520af004d0bd7a90d
MD5 7ea6c714a9a60ce25323f8af82a2968f
BLAKE2b-256 65a453d0e0d6b24d4f4dc25453a29a4fe003743f7fdda3352a0d32075aea6332

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