From 6035e62b8935130a1ad213163510f881f6ded0e4 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sun, 10 Jan 2021 10:56:45 -0500 Subject: Updated to the new verbly (which is a few years old at this point) --- owo.cpp | 43 ++++++++++++++++++++++++------------------- vendor/verbly | 2 +- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/owo.cpp b/owo.cpp index f66e689..ec9ffbb 100644 --- a/owo.cpp +++ b/owo.cpp @@ -16,33 +16,38 @@ int main(int argc, char** argv) std::string configfile(argv[1]); YAML::Node config = YAML::LoadFile(configfile); - + twitter::auth auth; auth.setConsumerKey(config["consumer_key"].as()); auth.setConsumerSecret(config["consumer_secret"].as()); auth.setAccessKey(config["access_key"].as()); auth.setAccessSecret(config["access_secret"].as()); - + twitter::client client(auth); - - verbly::data database {config["verbly_datafile"].as()}; - - verbly::noun bp = database.nouns().with_wnid(105220461).run().front(); // body part - verbly::noun pp = database.nouns().with_wnid(104723816).run().front(); // quality - verbly::noun cp = database.nouns().with_wnid(103051540).run().front(); // clothing - verbly::filter filt {bp, pp, cp}; - filt.set_orlogic(true); - + + verbly::database database {config["verbly_datafile"].as()}; + + verbly::filter nounFilter = + (verbly::notion::partOfSpeech == verbly::part_of_speech::noun) + && (verbly::form::proper == false) + && (verbly::notion::fullHypernyms %= ( + (verbly::notion::wnid == 105220461) // body part + || (verbly::notion::wnid == 104723816) // quality + || (verbly::notion::wnid == 103051540))); // clothing + for (;;) { std::cout << "Generating tweet" << std::endl; - - auto ns = database.nouns().full_hyponym_of(filt).is_not_proper().random().limit(1).run(); - verbly::noun n = ns.front(); - - std::string result = "*notices ur " + n.base_form() + "* OwO whats this..?"; + + verbly::word noun = database.words(nounFilter).first(); + verbly::token action = { + verbly::token::quote("*", "*", { "notices ur", noun }), + "OwO whats this..?" + }; + + std::string result = action.compile(); result.resize(140); - + try { client.updateStatus(result); @@ -50,9 +55,9 @@ int main(int argc, char** argv) { std::cout << "Twitter error: " << e.what() << std::endl; } - + std::cout << result << std::endl; - + std::this_thread::sleep_for(std::chrono::hours(1)); } } diff --git a/vendor/verbly b/vendor/verbly index 1f898f3..84bae57 160000 --- a/vendor/verbly +++ b/vendor/verbly @@ -1 +1 @@ -Subproject commit 1f898f3bd66c29672275c2c884b17ba662ced626 +Subproject commit 84bae572d353b03ecb3498df83ba301a456b6c6f -- cgit 1.4.1