Skip to main content

PyProfane

Build Status

Why I made this?

I went through a few libraries for profane languages like profanity, profanity-check and profanity-filter. While they're all good in their own right, I couldn't find one that suited my needs.

Installation

pip install PyProfane

Features

The special thing about this python library is that it uses soundex to detect even slightly misspelled words to detect if they're profane or not. Of course this is not a mighty addition but I feel like this can be useful.

Please note that it uses an explicit blacklist which can be modified as when you need as I have included a function updateSwearwords(filename)

Usage

from PyProfane import censorWord, censorSentences, isProfane

sentence = "you're a piece of shit"
word = "slutty"
sentences = ["you're a piece of shit",
 'fucking whore',
 'why you such a cumslut',
 'an online whore',
 'fucking wanker',
 'hey, hope you do great!',
 'sluttyyyy whoreeee',
 'wear a dress']

print(isProfane(sentence))  # returns True

print(censorWord(word)) # returns 's%!$ty'

print(censorSentences(sentences))
'''
returns
["you're a piece of s!it",
 'f#%$ing w#%re',
 'why you such a cu#%$ut',
 'an online w#%re',
 'fu#%$ng w#%$er',
 'hey, hope you do great!',
 's#ut%$!yy w#o%$!ee',
 'wear a dress']
'''

Data

The data for swear words has been taken from a subset of:

I just randomly included and deleted some of the words as I felt like, but please feel free to add more words by making pull requests.

Caveats

Like I said, this is exclusive to the swear words blacklist i.e. the data.

Contributing

Feel free to make suggestions, raise pull requests, and report issues. After all we're human and there can be problems with this bot.

Metadata

Release files for PyProfane 1.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for PyProfane 1.0.7
File Size Uploaded
PyProfane-1.0.7.tar.gz 6.5 kB Details

Release files / PyProfane-1.0.7.tar.gz

Download URL PyProfane-1.0.7.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
3e7f72d0cc3222ddbb869126aac9e7c8b225d9ab13a6ab5b4aeeb81f3d591ad6
BLAKE2b-256 checksum
How to use checksums
8bbe8e21bb6eae16942373843c23dbd712517ecbb1a38d0e4b8cd5640aa73548
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

Release history Release notifications | RSS feed

This release

1.0.7 This release

1 release file

1.0.6

1 release file

1.0.5

1 release file

1.0.4

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page