forked from thunlp/THULAC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathverbword.h
39 lines (34 loc) · 778 Bytes
/
verbword.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
#pragma once
#include <fstream>
#include <cstring>
#include "dat.h"
namespace thulac{
class VerbWord{
private:
DAT* vM_dat;
DAT* vD_dat;
std::string tag_v;
public:
VerbWord(const char* filename, const char* filename2){
vM_dat = new DAT(filename);
vD_dat = new DAT(filename2);
tag_v = "v";
};
void adjust(TaggedSentence& sentence){
if((!vM_dat)||(!vD_dat))return;
for(int i=0;i<sentence.size()-1;i++){
if((sentence[i].tag==tag_v)&&(sentence[i+1].tag==tag_v)){
if(vM_dat->match(sentence[i].word)!=-1){
sentence[i].tag="vm";
}else if(vD_dat->match(sentence[i+1].word)!=-1){
sentence[i+1].tag="vd";
}
}
}
};
~VerbWord(){
if(vM_dat) delete vM_dat;
if(vD_dat) delete vD_dat;
};
};
}//end for thulac