From 617155fe562652c859a380d85cc5710783d79448 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Mon, 1 Feb 2016 09:30:04 -0500 Subject: 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). --- prefix_search.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 prefix_search.h (limited to 'prefix_search.h') diff --git a/prefix_search.h b/prefix_search.h new file mode 100644 index 0000000..dd2f535 --- /dev/null +++ b/prefix_search.h @@ -0,0 +1,23 @@ +#ifndef PREFIX_SEARCH_H_5CFCF783 +#define PREFIX_SEARCH_H_5CFCF783 + +#include +#include + +class prefix_search { + public: + void add(std::string prefix); + int match(std::string in) const; + + private: + struct node { + std::map children; + bool match; + + node() : match(false) {} + }; + + node top; +}; + +#endif /* end of include guard: PREFIX_SEARCH_H_5CFCF783 */ -- cgit 1.4.1