📄 ahocorasick.cpp
字号:
#include <astl.h>#include <aho_corasick.h>#include <tools.h>#include <lazy.h>#include <match.h>#include <string>#include <iostream>#include <cstdio>#include <iterator>#include <algorithm>using namespace std;const string USAGE = "[-nl] file";const string DESCRIPTION = "search stdin for the set of words read from file\\n -nl\tno lazy construction optimization";int main(int argc, char **argv){ config c(argc, argv, 2, "", USAGE, DESCRIPTION); aho_corasick_cursor<plain> ac(c.aux_input); /// aho_corasick_cursor<plain> ac(istream_iterator<string>(aux_input), /// istream_iterator<string>()); ostream_iterator<char> out(cout); c.aux_input.close(); frandom_iterator<> first(stdin), last, match; if (find(c.options.begin(), c.options.end(), string("-nl")) == c.options.end()) { lazy_cursor_tag<aho_corasick_cursor<plain> > e = lazyc_tag(ac); for(; first != last; first = match) { match = first_match(first, last, e); if (match == first) break; // no match + EOF copy(match - e.src_tag().length(), match, out); } } else for(; first != last; first = match) { match = first_match(first, last, ac); if (match == first) break; // no match + EOF copy(match - ac.src_tag().length(), match, out); } return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -