about summary refs log tree commit diff stats
path: root/gen.cpp
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2016-02-01 09:30:04 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2016-02-01 09:30:04 -0500
commit617155fe562652c859a380d85cc5710783d79448 (patch)
treef5eee89b0fa4b3c9dfe7187ca78916a71b59045e /gen.cpp
parentb316e309559d7176af6cf0bb7dcd6dbaa83c01cd (diff)
downloadrawr-ebooks-617155fe562652c859a380d85cc5710783d79448.tar.gz
rawr-ebooks-617155fe562652c859a380d85cc5710783d79448.tar.bz2
rawr-ebooks-617155fe562652c859a380d85cc5710783d79448.zip
Added emoji freevar
Strings of emojis are tokenized separately from anything else, and added to an emoticon freevar, which is mixed in with regular emoticons like :P. This breaks old-style freevars like $name$ and $noun$ so some legacy support for compatibility is left in but eventually $name$ should be made into an actual new freevar. Emoji data is from gemoji (https://github.com/github/gemoji).
Diffstat (limited to 'gen.cpp')
-rw-r--r--gen.cpp8
1 files changed, 1 insertions, 7 deletions
diff --git a/gen.cpp b/gen.cpp index a0ef8e3..26edd21 100644 --- a/gen.cpp +++ b/gen.cpp
@@ -7,7 +7,6 @@
7#include <cstdlib> 7#include <cstdlib>
8#include <fstream> 8#include <fstream>
9#include <iostream> 9#include <iostream>
10#include "freevars.h"
11 10
12int main(int argc, char** args) 11int main(int argc, char** args)
13{ 12{
@@ -44,16 +43,11 @@ int main(int argc, char** args)
44 std::cout << "Preprocessing corpus..." << std::endl; 43 std::cout << "Preprocessing corpus..." << std::endl;
45 kgramstats* stats = new kgramstats(corpus, 4); 44 kgramstats* stats = new kgramstats(corpus, 4);
46 45
47 std::cout << "Preprocessing freevars..." << std::endl;
48 freevars* vars = new freevars();
49 vars->addVar("name", "names.txt");
50 vars->addVar("noun", "nouns.txt");
51
52 std::cout << "Generating..." << std::endl; 46 std::cout << "Generating..." << std::endl;
53 for (;;) 47 for (;;)
54 { 48 {
55 std::string doc = stats->randomSentence(rand() % 35 + 15); 49 std::string doc = stats->randomSentence(rand() % 35 + 15);
56 std::string hi = vars->parse(doc); 50 std::string hi = doc;
57 hi.resize(140); 51 hi.resize(140);
58 52
59 std::cout << hi << std::endl; 53 std::cout << hi << std::endl;