snguyenthanh / better_profanity

Blazingly fast cleaning swear words (and their leetspeak) in strings
MIT License
211 stars 70 forks source link

How to replace the swear word with the actual word? #29

Closed Akshar-code closed 3 years ago

Akshar-code commented 3 years ago

Hi, In this program, the swear words are replaced with asteriks, for example: F@@K will be shown as **** But i want change a sentence like "F@@k you" into "Fuck you"

How do i do this?

BradKML commented 3 years ago

You might want to read up on how this software works. It generates variations that add to the blocklist or detection list. Reversing the process might not yield as accurate of a result as compared to purely detecting word variations, as there will always be overlap with multiple curse words.

snguyenthanh commented 3 years ago

@BrandonKMLee is right. The library doesn't support uncensoring words (and probably won't in a long time).

The closest thing it can do to support your use case is to check whether a sentence has a variant of a profanity: profanity.contains_profanity('H4ndjob').