Добавил:
itan_hunt
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:lab6 / Aho_Corasick
.h#ifndef AHO_CORASICK_H
#define AHO_CORASICK_H
#include <string>
#include <map>
#include <vector>
#include <set>
#include <queue>
#include <algorithm>
#include <utility>
using namespace std;
using lli = long long int;
struct Node {
wstring pattern;
pair<char, Node*> inEdge;
map<char, Node*> outEdges;
Node *failure, *output;
Node(pair<char, Node*> inEdge): inEdge(inEdge), failure(nullptr), output(nullptr) {}
};
struct Trie {
Node* root;
Trie(set<wstring> patterns);
private:
void makeLinks(Node* &node);
};
map<wstring, set<lli>> AhoCorasick(wstring &text, Trie &trie);
set<lli> AhoCorasickWithJoker(wstring &text, wstring &myTemplate, wchar_t joker);
set<wstring> split(wstring &myTemplate, char delim);
#endif
Соседние файлы в папке lab6