From 7849e8d886523309a28a7941c398e6f64d95b0b0 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Wed, 15 Aug 2018 18:37:37 -0400 Subject: Added more defense against slurs It's unlikely that this bot was ever actually able to tweet slurs, but it's best to be sure. refs hatkirby/blessed#2 --- grunge.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'grunge.cpp') diff --git a/grunge.cpp b/grunge.cpp index bc3c560..cd63884 100644 --- a/grunge.cpp +++ b/grunge.cpp @@ -329,10 +329,15 @@ Magick::Image grunge::pastelizeImage(Magick::Image input) const std::string grunge::generateTweetText(verbly::word pictured) const { + verbly::filter formFilter = + (verbly::form::proper == false) + // Blacklist slurs and slur homographys + && !(verbly::word::usageDomains %= (verbly::notion::wnid == 106717170)); + verbly::word simpler = database_->words( (verbly::notion::partOfSpeech == verbly::part_of_speech::noun) && (verbly::notion::fullHyponyms %= pictured) - && (verbly::form::proper == false)).first(); + && (verbly::word::forms(verbly::inflection::base) %= formFilter)).first(); std::vector symbols = {"☯","✡","☨","✞","✝","☮","☥","☦","☪","✌"}; std::string prefix; -- cgit 1.4.1