about summary refs log tree commit diff stats
path: root/histogram.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 /histogram.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 'histogram.cpp')
-rw-r--r--histogram.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/histogram.cpp b/histogram.cpp index 6896146..6d31cf4 100644 --- a/histogram.cpp +++ b/histogram.cpp
@@ -1,5 +1,6 @@
1#include "histogram.h" 1#include "histogram.h"
2#include <cstdlib> 2#include <cstdlib>
3#include <iostream>
3 4
4template <class T> 5template <class T>
5void histogram<T>::add(const T& inst) 6void histogram<T>::add(const T& inst)
@@ -31,4 +32,13 @@ const T& histogram<T>::next() const
31 return distribution.upper_bound(r)->second; 32 return distribution.upper_bound(r)->second;
32} 33}
33 34
35template <class T>
36void histogram<T>::print() const
37{
38 for (auto& freqpair : freqtable)
39 {
40 std::cout << freqpair.first << ": " << freqpair.second << std::endl;
41 }
42}
43
34template class histogram <std::string>; 44template class histogram <std::string>;