forked from rime/librime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
simplifier.h
56 lines (43 loc) · 1.26 KB
/
simplifier.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
56
//
// Copyright RIME Developers
// Distributed under the BSD License
//
// 2011-12-12 GONG Chen <chen.sst@gmail.com>
//
#ifndef RIME_SIMPLIFIER_H_
#define RIME_SIMPLIFIER_H_
#include <rime/filter.h>
#include <rime/algo/algebra.h>
#include <rime/gear/filter_commons.h>
namespace rime {
class Opencc;
class Simplifier : public Filter, TagMatching {
public:
explicit Simplifier(const Ticket& ticket);
virtual an<Translation> Apply(an<Translation> translation,
CandidateList* candidates);
virtual bool AppliesToSegment(Segment* segment) {
return TagsMatch(segment);
}
bool Convert(const an<Candidate>& original,
CandidateQueue* result);
protected:
enum TipsLevel { kTipsNone, kTipsChar, kTipsAll };
void Initialize();
void PushBack(const an<Candidate>& original,
CandidateQueue* result,
const string& simplified);
bool initialized_ = false;
the<Opencc> opencc_;
// settings
TipsLevel tips_level_ = kTipsNone;
string option_name_;
string opencc_config_;
set<string> excluded_types_;
bool show_in_comment_ = false;
bool allow_erase_comment_ = false;
Projection comment_formatter_;
bool random_ = false;
};
} // namespace rime
#endif // RIME_SIMPLIFIER_H_