blob: ff3e7a6379759fe7777b54b69c11b5d7a1450a6f (
plain)
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
|
#ifndef _VOCABULARY_H_
#define _VOCABULARY_H_
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
class Vocabulary {
public:
virtual ~Vocabulary();
virtual int GetTerminalIndex(const string& word);
int GetNonterminalIndex(int position);
bool IsTerminal(int symbol);
virtual string GetTerminalValue(int symbol);
int Size();
private:
unordered_map<string, int> dictionary;
vector<string> words;
};
#endif
|