forked from apertium/apertium-lex-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtagger_output_processor.h
55 lines (43 loc) · 1.04 KB
/
tagger_output_processor.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef TAGGER_OUTPUT_PROCESSOR
#define TAGGER_OUTPUT_PROCESSOR
#include <stdio.h>
#include <string>
#include <iostream>
#include <lttoolbox/fst_processor.h>
#include <lttoolbox/lt_locale.h>
#include <lttoolbox/ltstr.h>
#include <cwchar>
#include <set>
#include <apertium/tsx_reader.h>
#include <apertium/string_utils.h>
using namespace std;
class TaggerToken {
public:
wstring lemma;
vector<wstring> tags;
wstring toString(bool delimiters) {
wstring out = lemma;
for(unsigned int i = 0; i < tags.size(); i++) {
out += L"<" + tags[i] + L">";
}
if (delimiters) {
out = L"^" + out + L"$";
}
return out;
}
};
class TaggerOutputProcessor {
protected:
int sn;
vector<wstring> parseTags(wstring token);
vector<wstring> wsplit(wstring wstr, wchar_t delim);
TaggerToken parseTaggerToken(wstring buffer);
int find(vector<wstring> xs, wstring x);
wstring getLemma(wstring token);
virtual void processSentence(vector<TaggerToken>) =0;
public:
TaggerOutputProcessor();
~TaggerOutputProcessor();
void processTaggerOutput();
};
#endif