-
Notifications
You must be signed in to change notification settings - Fork 1
/
hfst_rules_extensions.cc
174 lines (170 loc) · 8.33 KB
/
hfst_rules_extensions.cc
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
namespace hfst {
// *** Wrappers for rule functions. *** //
namespace hfst_rules {
HfstTransducer two_level_if(const HfstTransducerPair & context, const StringPairSet & mappings, const StringPairSet & alphabet)
{
hfst::HfstTransducerPair context_(context);
StringPairSet mappings_(mappings);
StringPairSet alphabet_(alphabet);
return hfst::rules::two_level_if(context_, mappings_, alphabet_);
}
HfstTransducer two_level_only_if(const HfstTransducerPair &context, const StringPairSet &mappings, const StringPairSet &alphabet)
{
hfst::HfstTransducerPair context_(context);
StringPairSet mappings_(mappings);
StringPairSet alphabet_(alphabet);
return hfst::rules::two_level_only_if(context_, mappings_, alphabet_);
}
HfstTransducer two_level_if_and_only_if(const HfstTransducerPair &context, const StringPairSet &mappings, const StringPairSet &alphabet)
{
hfst::HfstTransducerPair context_(context);
StringPairSet mappings_(mappings);
StringPairSet alphabet_(alphabet);
return hfst::rules::two_level_if_and_only_if(context_, mappings_, alphabet_);
}
HfstTransducer replace_down(const HfstTransducerPair &context, const HfstTransducer &mapping, bool optional, const StringPairSet &alphabet)
{
hfst::HfstTransducerPair context_(context);
hfst::HfstTransducer mapping_(mapping);
StringPairSet alphabet_(alphabet);
return hfst::rules::replace_down(context_, mapping_, optional, alphabet_);
}
HfstTransducer replace_down_karttunen(const HfstTransducerPair &context, const HfstTransducer &mapping, bool optional, const StringPairSet &alphabet)
{
hfst::HfstTransducerPair context_(context);
hfst::HfstTransducer mapping_(mapping);
StringPairSet alphabet_(alphabet);
return hfst::rules::replace_down_karttunen(context_, mapping_, optional, alphabet_);
}
HfstTransducer replace_right(const HfstTransducerPair &context, const HfstTransducer &mapping, bool optional, const StringPairSet &alphabet)
{
hfst::HfstTransducerPair context_(context);
hfst::HfstTransducer mapping_(mapping);
StringPairSet alphabet_(alphabet);
return hfst::rules::replace_right(context_, mapping_, optional, alphabet_);
}
HfstTransducer replace_left(const HfstTransducerPair &context, const HfstTransducer &mapping, bool optional, const StringPairSet &alphabet)
{
hfst::HfstTransducerPair context_(context);
hfst::HfstTransducer mapping_(mapping);
StringPairSet alphabet_(alphabet);
return hfst::rules::replace_left(context_, mapping_, optional, alphabet_);
}
HfstTransducer replace_up(const HfstTransducer &mapping, bool optional, const StringPairSet &alphabet)
{
hfst::HfstTransducer mapping_(mapping);
StringPairSet alphabet_(alphabet);
return hfst::rules::replace_up(mapping_, optional, alphabet_);
}
HfstTransducer replace_down(const HfstTransducer &mapping, bool optional, const StringPairSet &alphabet)
{
hfst::HfstTransducer mapping_(mapping);
StringPairSet alphabet_(alphabet);
return hfst::rules::replace_down(mapping_, optional, alphabet_);
}
HfstTransducer left_replace_up(const HfstTransducer &mapping, bool optional, const StringPairSet &alphabet)
{
hfst::HfstTransducer mapping_(mapping);
StringPairSet alphabet_(alphabet);
return hfst::rules::left_replace_up(mapping_, optional, alphabet_);
}
HfstTransducer left_replace_up(const HfstTransducerPair &context, const HfstTransducer &mapping, bool optional, const StringPairSet &alphabet)
{
hfst::HfstTransducerPair context_(context);
hfst::HfstTransducer mapping_(mapping);
StringPairSet alphabet_(alphabet);
return hfst::rules::left_replace_up(context_, mapping_, optional, alphabet_);
}
HfstTransducer left_replace_down(const HfstTransducerPair &context, const HfstTransducer &mapping, bool optional, const StringPairSet &alphabet)
{
hfst::HfstTransducerPair context_(context);
hfst::HfstTransducer mapping_(mapping);
StringPairSet alphabet_(alphabet);
return hfst::rules::left_replace_down(context_, mapping_, optional, alphabet_);
}
HfstTransducer left_replace_down_karttunen(const HfstTransducerPair &context, const HfstTransducer &mapping, bool optional, const StringPairSet &alphabet)
{
hfst::HfstTransducerPair context_(context);
hfst::HfstTransducer mapping_(mapping);
StringPairSet alphabet_(alphabet);
return hfst::rules::left_replace_down_karttunen(context_, mapping_, optional, alphabet_);
}
HfstTransducer left_replace_left(const HfstTransducerPair &context, const HfstTransducer &mapping, bool optional, const StringPairSet &alphabet)
{
hfst::HfstTransducerPair context_(context);
hfst::HfstTransducer mapping_(mapping);
StringPairSet alphabet_(alphabet);
return hfst::rules::left_replace_left(context_, mapping_, optional, alphabet_);
}
HfstTransducer left_replace_right(const HfstTransducerPair &context, const HfstTransducer &mapping, bool optional, const StringPairSet &alphabet)
{
hfst::HfstTransducerPair context_(context);
hfst::HfstTransducer mapping_(mapping);
StringPairSet alphabet_(alphabet);
return hfst::rules::left_replace_right(context_, mapping_, optional, alphabet_);
}
HfstTransducer restriction(const HfstTransducerPairVector &contexts, const HfstTransducer &mapping, const StringPairSet &alphabet)
{
hfst::HfstTransducerPairVector contexts_(contexts);
hfst::HfstTransducer mapping_(mapping);
StringPairSet alphabet_(alphabet);
return hfst::rules::restriction(contexts_, mapping_, alphabet_);
}
HfstTransducer coercion(const HfstTransducerPairVector &contexts, const HfstTransducer &mapping, const StringPairSet &alphabet)
{
hfst::HfstTransducerPairVector contexts_(contexts);
hfst::HfstTransducer mapping_(mapping);
StringPairSet alphabet_(alphabet);
return hfst::rules::coercion(contexts_, mapping_, alphabet_);
}
HfstTransducer restriction_and_coercion(const HfstTransducerPairVector &contexts, const HfstTransducer &mapping, const StringPairSet &alphabet)
{
hfst::HfstTransducerPairVector contexts_(contexts);
hfst::HfstTransducer mapping_(mapping);
StringPairSet alphabet_(alphabet);
return hfst::rules::restriction_and_coercion(contexts_, mapping_, alphabet_);
}
HfstTransducer surface_restriction(const HfstTransducerPairVector &contexts, const HfstTransducer &mapping, const StringPairSet &alphabet)
{
hfst::HfstTransducerPairVector contexts_(contexts);
hfst::HfstTransducer mapping_(mapping);
StringPairSet alphabet_(alphabet);
return hfst::rules::surface_restriction(contexts_, mapping_, alphabet_);
}
HfstTransducer surface_coercion(const HfstTransducerPairVector &contexts, const HfstTransducer &mapping, const StringPairSet &alphabet)
{
hfst::HfstTransducerPairVector contexts_(contexts);
hfst::HfstTransducer mapping_(mapping);
StringPairSet alphabet_(alphabet);
return hfst::rules::surface_coercion(contexts_, mapping_, alphabet_);
}
HfstTransducer surface_restriction_and_coercion(const HfstTransducerPairVector &contexts, const HfstTransducer &mapping, const StringPairSet &alphabet)
{
hfst::HfstTransducerPairVector contexts_(contexts);
hfst::HfstTransducer mapping_(mapping);
StringPairSet alphabet_(alphabet);
return hfst::rules::surface_restriction_and_coercion(contexts_, mapping_, alphabet_);
}
HfstTransducer deep_restriction(const HfstTransducerPairVector &contexts, const HfstTransducer &mapping, const StringPairSet &alphabet)
{
hfst::HfstTransducerPairVector contexts_(contexts);
hfst::HfstTransducer mapping_(mapping);
StringPairSet alphabet_(alphabet);
return hfst::rules::deep_restriction(contexts_, mapping_, alphabet_);
}
HfstTransducer deep_coercion(const HfstTransducerPairVector &contexts, const HfstTransducer &mapping, const StringPairSet &alphabet)
{
hfst::HfstTransducerPairVector contexts_(contexts);
hfst::HfstTransducer mapping_(mapping);
StringPairSet alphabet_(alphabet);
return hfst::rules::deep_coercion(contexts_, mapping_, alphabet_);
}
HfstTransducer deep_restriction_and_coercion(const HfstTransducerPairVector &contexts, const HfstTransducer &mapping, const StringPairSet &alphabet)
{
hfst::HfstTransducerPairVector contexts_(contexts);
hfst::HfstTransducer mapping_(mapping);
StringPairSet alphabet_(alphabet);
return hfst::rules::deep_restriction_and_coercion(contexts_, mapping_, alphabet_);
}
}
}