diff options
-rw-r--r-- | main.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/main.cpp b/main.cpp index 8310bf4..20f1a1f 100644 --- a/main.cpp +++ b/main.cpp | |||
@@ -17,19 +17,19 @@ int main(int argc, char** args) | |||
17 | { | 17 | { |
18 | srand(time(NULL)); | 18 | srand(time(NULL)); |
19 | 19 | ||
20 | YAML::Node config = YAML::LoadFile("config.yml"); | 20 | YAML::Node config = YAML::LoadFile("config.yml"); |
21 | 21 | ifstream infile(config["corpus"].as<std::string>().c_str()); | |
22 | for (;;) | 22 | string corpus; |
23 | string line; | ||
24 | while (getline(infile, line)) | ||
23 | { | 25 | { |
24 | ifstream infile(config["corpus"].as<std::string>().c_str()); | 26 | corpus += " " + line; |
25 | string corpus; | 27 | } |
26 | string line; | 28 | |
27 | while (getline(infile, line)) | 29 | kgramstats* stats = new kgramstats(corpus, 5); |
28 | { | ||
29 | corpus += " " + line; | ||
30 | } | ||
31 | 30 | ||
32 | kgramstats* stats = new kgramstats(corpus, 5); | 31 | for (;;) |
32 | { | ||
33 | vector<string> doc = stats->randomSentence(rand() % 25 + 5); | 33 | vector<string> doc = stats->randomSentence(rand() % 25 + 5); |
34 | string hi; | 34 | string hi; |
35 | for (vector<string>::iterator it = doc.begin(); it != doc.end(); ++it) | 35 | for (vector<string>::iterator it = doc.begin(); it != doc.end(); ++it) |