diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-02-01 09:30:04 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-02-01 09:30:04 -0500 |
commit | 617155fe562652c859a380d85cc5710783d79448 (patch) | |
tree | f5eee89b0fa4b3c9dfe7187ca78916a71b59045e /histogram.cpp | |
parent | b316e309559d7176af6cf0bb7dcd6dbaa83c01cd (diff) | |
download | rawr-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.cpp | 10 |
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 | ||
4 | template <class T> | 5 | template <class T> |
5 | void histogram<T>::add(const T& inst) | 6 | void 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 | ||
35 | template <class T> | ||
36 | void histogram<T>::print() const | ||
37 | { | ||
38 | for (auto& freqpair : freqtable) | ||
39 | { | ||
40 | std::cout << freqpair.first << ": " << freqpair.second << std::endl; | ||
41 | } | ||
42 | } | ||
43 | |||
34 | template class histogram <std::string>; | 44 | template class histogram <std::string>; |