about summary refs log tree commit diff stats
path: root/ebooks.cpp
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2016-01-29 12:43:00 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2016-01-29 12:43:00 -0500
commitb316e309559d7176af6cf0bb7dcd6dbaa83c01cd (patch)
treef21bd883ef7c4255a91d096ea105feaad135ee52 /ebooks.cpp
parentfd1e9d59694c8a6ba201d2cdffec50f4f590841d (diff)
downloadrawr-ebooks-b316e309559d7176af6cf0bb7dcd6dbaa83c01cd.tar.gz
rawr-ebooks-b316e309559d7176af6cf0bb7dcd6dbaa83c01cd.tar.bz2
rawr-ebooks-b316e309559d7176af6cf0bb7dcd6dbaa83c01cd.zip
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.
Diffstat (limited to 'ebooks.cpp')
-rw-r--r--ebooks.cpp15
1 files changed, 2 insertions, 13 deletions
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)
44 std::cout << "Generating..." << std::endl; 44 std::cout << "Generating..." << std::endl;
45 for (;;) 45 for (;;)
46 { 46 {
47 std::vector<std::string> doc = stats->randomSentence(rand() % 45 + 5); 47 std::string doc = stats->randomSentence(rand() % 45 + 5);
48 std::string hi; 48 std::string hi = vars->parse(doc);
49 for (std::vector<std::string>::iterator it = doc.begin(); it != doc.end(); ++it)
50 {
51 hi += vars->parse(*it) + " ";
52 }
53
54 hi.resize(140); 49 hi.resize(140);
55
56 size_t lastperiod = hi.find_last_of(".!?,");
57 if ((lastperiod != std::string::npos) && (rand() % 3 > 0))
58 {
59 hi = hi.substr(0, lastperiod+1);
60 }
61 50
62 std::string replyMsg; 51 std::string replyMsg;
63 if (twitter.statusUpdate(hi)) 52 if (twitter.statusUpdate(hi))