From b316e309559d7176af6cf0bb7dcd6dbaa83c01cd Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Fri, 29 Jan 2016 12:43:00 -0500 Subject: Rewrote how tokens are handled A 'word' is now an object that contains a distribution of forms that word can take. For now, most word just contain one form, the canonical one. The only special use is currently hashtags. Malapropisms have been disabled because of compatibility issues and because an upcoming feature is planned to replace it. --- ebooks.cpp | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'ebooks.cpp') diff --git a/ebooks.cpp b/ebooks.cpp index e38ebab..ed1e080 100644 --- a/ebooks.cpp +++ b/ebooks.cpp @@ -44,20 +44,9 @@ int main(int argc, char** args) std::cout << "Generating..." << std::endl; for (;;) { - std::vector doc = stats->randomSentence(rand() % 45 + 5); - std::string hi; - for (std::vector::iterator it = doc.begin(); it != doc.end(); ++it) - { - hi += vars->parse(*it) + " "; - } - + std::string doc = stats->randomSentence(rand() % 45 + 5); + std::string hi = vars->parse(doc); hi.resize(140); - - size_t lastperiod = hi.find_last_of(".!?,"); - if ((lastperiod != std::string::npos) && (rand() % 3 > 0)) - { - hi = hi.substr(0, lastperiod+1); - } std::string replyMsg; if (twitter.statusUpdate(hi)) -- cgit 1.4.1