diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-01-29 12:43:00 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-01-29 12:43:00 -0500 |
commit | b316e309559d7176af6cf0bb7dcd6dbaa83c01cd (patch) | |
tree | f21bd883ef7c4255a91d096ea105feaad135ee52 /gen.cpp | |
parent | fd1e9d59694c8a6ba201d2cdffec50f4f590841d (diff) | |
download | rawr-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 'gen.cpp')
-rw-r--r-- | gen.cpp | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/gen.cpp b/gen.cpp index 400c0a5..a0ef8e3 100644 --- a/gen.cpp +++ b/gen.cpp | |||
@@ -52,21 +52,10 @@ int main(int argc, char** args) | |||
52 | std::cout << "Generating..." << std::endl; | 52 | std::cout << "Generating..." << std::endl; |
53 | for (;;) | 53 | for (;;) |
54 | { | 54 | { |
55 | std::vector<std::string> doc = stats->randomSentence(rand() % 35 + 15); | 55 | std::string doc = stats->randomSentence(rand() % 35 + 15); |
56 | std::string hi; | 56 | std::string hi = vars->parse(doc); |
57 | for (std::vector<std::string>::iterator it = doc.begin(); it != doc.end(); ++it) | ||
58 | { | ||
59 | hi += vars->parse(*it) + " "; | ||
60 | } | ||
61 | |||
62 | hi.resize(140); | 57 | hi.resize(140); |
63 | 58 | ||
64 | size_t lastperiod = hi.find_last_of(".!?,"); | ||
65 | if ((lastperiod != std::string::npos) && (rand() % 3 > 0)) | ||
66 | { | ||
67 | hi = hi.substr(0, lastperiod+1); | ||
68 | } | ||
69 | |||
70 | std::cout << hi << std::endl; | 59 | std::cout << hi << std::endl; |
71 | 60 | ||
72 | getc(stdin); | 61 | getc(stdin); |