-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpostagger_model.h
40 lines (30 loc) · 970 Bytes
/
postagger_model.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
#ifndef POSTAGGER_MODEL_H
#define POSTAGGER_MODEL_H
#include <iostream>
#include <sstream>
#include <vector>
#include <map>
#include <unordered_map>
using namespace std;
class PerceptronTagger;
extern unordered_map<string, unordered_map<string, string> > keywords;
extern vector<string> keyword_insertion;
class Postagger_Model {
PerceptronTagger *postagger;
map<string, string> *specified_tags;
vector<pair<string, float> > *bias_weights;
vector<map<string, vector<pair<string, float> > > > *weights;
void load_pos_tagger();
public:
Postagger_Model(): postagger(nullptr), specified_tags(nullptr),
bias_weights(nullptr), weights(nullptr) {}
~Postagger_Model();
vector<pair<string, string> > tag_sentence(string str);
PerceptronTagger* get_pos_tagger(){
if (postagger == nullptr){
load_pos_tagger();
}
return postagger;
}
};
#endif