diff options
Diffstat (limited to 'ebooks.cpp')
-rw-r--r-- | ebooks.cpp | 15 |
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)) |