-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNGram.h
41 lines (34 loc) · 1009 Bytes
/
NGram.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef NGram_h
#define NGram_h
#include <vector>
#include <string>
#include <sstream>
#include <iostream>
#include <fstream>
#include <map>
class NGram {
public:
class Node {
public:
int hits;
std::map<std::string, Node*> children;
Node();
void addHit();
void setHit(int newHits);
void nodePrint(int levels, Node* p, std::string totalSeq = "");
int nodeCount(int levels, Node* p);
void nodeWrite(int levels, Node* p, std::string fName, std::string totalSeq = "");
void startWrite(int levels, Node* p, std::string fName);
void add(std::pair<std::string, Node*> newWord);
std::string predict(Node* p, std::string sentence, std::string totalSeq = "");
};
void addWord(std::string newWord);
void addSequence(std::string sent);
void addModelFile(std::string fName);
void addFile(std::string fName);
void print(int levels);
void ngramWrite(std::string fName, int levels = 3);
std::string predict(std::string sentence, std::string totalSeq = "");
Node rootNode;
};
#endif