diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2017-02-13 11:02:16 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2017-02-13 11:02:16 -0500 |
commit | c0232ec87d669ef859f08b76e4b3bcaf881611f1 (patch) | |
tree | 8e950f72b48d3258ab5cd28644449441f8bff06f | |
parent | f33210aebfa4fc8055566fe3bc2f38713b7fe1fb (diff) | |
download | blessed-c0232ec87d669ef859f08b76e4b3bcaf881611f1.tar.gz blessed-c0232ec87d669ef859f08b76e4b3bcaf881611f1.tar.bz2 blessed-c0232ec87d669ef859f08b76e4b3bcaf881611f1.zip |
Fixed verb query returning words with no valid verbs
Also updated verbly for query time improvements.
-rw-r--r-- | blessed.cpp | 26 | ||||
m--------- | vendor/verbly | 0 |
2 files changed, 16 insertions, 10 deletions
diff --git a/blessed.cpp b/blessed.cpp index 8bb8d3f..02f4273 100644 --- a/blessed.cpp +++ b/blessed.cpp | |||
@@ -57,24 +57,30 @@ int main(int argc, char** argv) | |||
57 | std::uniform_int_distribution<int> emojidist(0, emojis.size()-1); | 57 | std::uniform_int_distribution<int> emojidist(0, emojis.size()-1); |
58 | std::bernoulli_distribution continuedist(1.0/2.0); | 58 | std::bernoulli_distribution continuedist(1.0/2.0); |
59 | 59 | ||
60 | verbly::query<verbly::form> verbQuery = database.forms( | 60 | verbly::filter nounFilter = |
61 | (verbly::notion::partOfSpeech == verbly::part_of_speech::noun) | ||
62 | && (verbly::form::proper == false) | ||
63 | // Blacklist ethnic slurs | ||
64 | && !(verbly::word::usageDomains %= (verbly::notion::wnid == 106718862)); | ||
65 | |||
66 | verbly::query<verbly::word> verbQuery = database.words( | ||
61 | (verbly::notion::partOfSpeech == verbly::part_of_speech::verb) | 67 | (verbly::notion::partOfSpeech == verbly::part_of_speech::verb) |
62 | && (verbly::pronunciation::rhymes)); | 68 | && (verbly::pronunciation::rhymes %= nounFilter)); |
63 | 69 | ||
64 | for (;;) | 70 | for (;;) |
65 | { | 71 | { |
66 | std::cout << "Generating tweet..." << std::endl; | 72 | std::cout << "Generating tweet..." << std::endl; |
67 | 73 | ||
68 | verbly::form verb = verbQuery.first(); | 74 | verbly::word verb = verbQuery.first(); |
75 | |||
76 | verbly::word noun = database.words( | ||
77 | (verbly::pronunciation::rhymes %= verb) | ||
78 | && nounFilter).first(); | ||
69 | 79 | ||
70 | verbly::form noun = database.forms( | 80 | verbly::token utter; |
71 | (verbly::notion::partOfSpeech == verbly::part_of_speech::noun) | 81 | utter << "god" << verb << "this" << noun; |
72 | && (verbly::pronunciation::rhymes %= verb) | ||
73 | && (verbly::form::proper == false) | ||
74 | && (verbly::form::id != verb.getId()) | ||
75 | && !(verbly::word::usageDomains %= (verbly::notion::wnid == 106718862))).first(); | ||
76 | 82 | ||
77 | std::string exclamation = "god " + verb.getText() + " this " + noun.getText(); | 83 | std::string exclamation = utter.compile(); |
78 | 84 | ||
79 | std::string emojibef; | 85 | std::string emojibef; |
80 | std::string emojiaft; | 86 | std::string emojiaft; |
diff --git a/vendor/verbly b/vendor/verbly | |||
Subproject f1f67e62cebb4144f0599196263cd93b41fa972 | Subproject a354b1f864523e9def80aa1b3a561bce6bdb05a | ||