summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2018-08-15 18:37:37 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2018-08-15 18:37:37 -0400
commit7849e8d886523309a28a7941c398e6f64d95b0b0 (patch)
treef7e97fa50b1389f86044adda2f9381b0df88cebd
parent2af91f078202eece89c1bc2f4ea2b1ce8b770932 (diff)
downloadgrunge-7849e8d886523309a28a7941c398e6f64d95b0b0.tar.gz
grunge-7849e8d886523309a28a7941c398e6f64d95b0b0.tar.bz2
grunge-7849e8d886523309a28a7941c398e6f64d95b0b0.zip
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
-rw-r--r--grunge.cpp7
1 files changed, 6 insertions, 1 deletions
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
329 329
330std::string grunge::generateTweetText(verbly::word pictured) const 330std::string grunge::generateTweetText(verbly::word pictured) const
331{ 331{
332 verbly::filter formFilter =
333 (verbly::form::proper == false)
334 // Blacklist slurs and slur homographys
335 && !(verbly::word::usageDomains %= (verbly::notion::wnid == 106717170));
336
332 verbly::word simpler = database_->words( 337 verbly::word simpler = database_->words(
333 (verbly::notion::partOfSpeech == verbly::part_of_speech::noun) 338 (verbly::notion::partOfSpeech == verbly::part_of_speech::noun)
334 && (verbly::notion::fullHyponyms %= pictured) 339 && (verbly::notion::fullHyponyms %= pictured)
335 && (verbly::form::proper == false)).first(); 340 && (verbly::word::forms(verbly::inflection::base) %= formFilter)).first();
336 341
337 std::vector<std::string> symbols = {"☯","✡","☨","✞","✝","☮","☥","☦","☪","✌"}; 342 std::vector<std::string> symbols = {"☯","✡","☨","✞","✝","☮","☥","☦","☪","✌"};
338 std::string prefix; 343 std::string prefix;