about summary refs log tree commit diff stats
path: root/ebooks.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 /ebooks.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 'ebooks.cpp')
-rw-r--r--ebooks.cpp8
1 files changed, 1 insertions, 7 deletions
diff --git a/ebooks.cpp b/ebooks.cpp index ed1e080..fdbeeab 100644 --- a/ebooks.cpp +++ b/ebooks.cpp
@@ -10,7 +10,6 @@
10#include <twitcurl.h> 10#include <twitcurl.h>
11#include <unistd.h> 11#include <unistd.h>
12#include <yaml-cpp/yaml.h> 12#include <yaml-cpp/yaml.h>
13#include "freevars.h"
14 13
15int main(int argc, char** args) 14int main(int argc, char** args)
16{ 15{
@@ -29,11 +28,6 @@ int main(int argc, char** args)
29 28
30 std::cout << "Preprocessing corpus..." << std::endl; 29 std::cout << "Preprocessing corpus..." << std::endl;
31 kgramstats* stats = new kgramstats(corpus, 4); 30 kgramstats* stats = new kgramstats(corpus, 4);
32
33 std::cout << "Preprocessing freevars..." << std::endl;
34 freevars* vars = new freevars();
35 vars->addVar("name", "names.txt");
36 vars->addVar("noun", "nouns.txt");
37 31
38 twitCurl twitter; 32 twitCurl twitter;
39 twitter.getOAuth().setConsumerKey(config["consumer_key"].as<std::string>()); 33 twitter.getOAuth().setConsumerKey(config["consumer_key"].as<std::string>());
@@ -45,7 +39,7 @@ int main(int argc, char** args)
45 for (;;) 39 for (;;)
46 { 40 {
47 std::string doc = stats->randomSentence(rand() % 45 + 5); 41 std::string doc = stats->randomSentence(rand() % 45 + 5);
48 std::string hi = vars->parse(doc); 42 std::string hi = doc;
49 hi.resize(140); 43 hi.resize(140);
50 44
51 std::string replyMsg; 45 std::string replyMsg;