r/learnpython • u/Hayden2332 • Dec 10 '20
Python library for detecting hate speech?
I’ve been writing a discord bot over the course of this year and a new functionality I want to add is a check for hate speech. I’m currently using better-profanity, but that treats regular profanity and hate speech as the same, which is not ideal, I’d like users to still be able to send profane messages, just not offensive ones. The other library I’ve tried is HateSonar however, if the user attempts to bypass the filter by using numbers, it no longer works. Even in the example code at the link above, it only has a confidence of 60% for a word that is incredibly offensive. My google-fu is failing me and I was hoping you guys may have some suggestions. Thank you!
0
Upvotes
2
u/HeresYourFeedback Dec 10 '20
I don't think a lot of effort has been put into training HateSonar. Erase Hate is a little better but it's a third party service. If you want to make something like better-profanity but that reports which words are present and you can check them against a blacklist, that's not hard. If you want a practically useful version of HateSonar, good luck with that.