summaryrefslogtreecommitdiff
path: root/extractor/vocabulary.h
blob: dcc2a8fa9e5b33fd5d5d7ddd30d45fc16c9eb993 (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
30
31
32
33
#ifndef _VOCABULARY_H_
#define _VOCABULARY_H_

#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

namespace extractor {

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;
};

} // namespace extractor

#endif