about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2016-05-26 21:46:41 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2016-05-26 21:46:41 -0400
commit4d217ac6122120d9e86248432594864e114e3a46 (patch)
tree314d758bad971572d27582ef523c526e119d295a
parent6fbc06504c448a2972a01438b920bc61523e4683 (diff)
downloadrawr-ebooks-4d217ac6122120d9e86248432594864e114e3a46.tar.gz
rawr-ebooks-4d217ac6122120d9e86248432594864e114e3a46.tar.bz2
rawr-ebooks-4d217ac6122120d9e86248432594864e114e3a46.zip
Fixed ebooks and gen ignoring the form distribution
-rw-r--r--ebooks.cpp8
-rw-r--r--gen.cpp8
2 files changed, 8 insertions, 8 deletions
diff --git a/ebooks.cpp b/ebooks.cpp index 8b567ed..52247da 100644 --- a/ebooks.cpp +++ b/ebooks.cpp
@@ -64,14 +64,14 @@ int main(int argc, char** args)
64 rawr kgramstats; 64 rawr kgramstats;
65 kgramstats.addCorpus(corpus); 65 kgramstats.addCorpus(corpus);
66 kgramstats.compile(4); 66 kgramstats.compile(4);
67 kgramstats.setTransformCallback([&] (std::string canonical, std::string) { 67 kgramstats.setTransformCallback([&] (std::string, std::string form) {
68 size_t pos = canonical.find("$name$"); 68 size_t pos = form.find("$name$");
69 if (pos != std::string::npos) 69 if (pos != std::string::npos)
70 { 70 {
71 canonical.replace(pos, 6, fv_names[rand() % fv_names.size()]); 71 form.replace(pos, 6, fv_names[rand() % fv_names.size()]);
72 } 72 }
73 73
74 return canonical; 74 return form;
75 }); 75 });
76 76
77 std::mutex stats_mutex; 77 std::mutex stats_mutex;
diff --git a/gen.cpp b/gen.cpp index eba0277..5e2d9db 100644 --- a/gen.cpp +++ b/gen.cpp
@@ -69,14 +69,14 @@ int main(int argc, char** args)
69 rawr kgramstats; 69 rawr kgramstats;
70 kgramstats.addCorpus(corpus); 70 kgramstats.addCorpus(corpus);
71 kgramstats.compile(4); 71 kgramstats.compile(4);
72 kgramstats.setTransformCallback([&] (std::string canonical, std::string) { 72 kgramstats.setTransformCallback([&] (std::string, std::string form) {
73 size_t pos = canonical.find("$name$"); 73 size_t pos = form.find("$name$");
74 if (pos != std::string::npos) 74 if (pos != std::string::npos)
75 { 75 {
76 canonical.replace(pos, 6, fv_names[rand() % fv_names.size()]); 76 form.replace(pos, 6, fv_names[rand() % fv_names.size()]);
77 } 77 }
78 78
79 return canonical; 79 return form;
80 }); 80 });
81 81
82 std::cout << "Generating..." << std::endl; 82 std::cout << "Generating..." << std::endl;