1 /*
2 * Copyright (C) 2005 Universitat d'Alacant / Universidad de Alicante
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see <http://www.gnu.org/licenses/>.
16 */
17 #include <apertium/tagger_data.h>
18 #include <lttoolbox/compression.h>
19 #include <apertium/endian_double_util.h>
20 #include <apertium/string_utils.h>
21
22 using namespace Apertium;
23
24 void
copy(TaggerData const & o)25 TaggerData::copy(TaggerData const &o)
26 {
27 open_class = o.open_class;
28 forbid_rules = o.forbid_rules;
29 tag_index = o.tag_index;
30 array_tags = o.array_tags;
31 enforce_rules = o.enforce_rules;
32 prefer_rules = o.prefer_rules;
33 constants = o.constants;
34 output = o.output;
35 plist = o.plist;
36 }
37
TaggerData()38 TaggerData::TaggerData()
39 {
40 }
41
~TaggerData()42 TaggerData::~TaggerData()
43 {
44 }
45
TaggerData(TaggerData const & o)46 TaggerData::TaggerData(TaggerData const &o)
47 {
48 copy(o);
49 }
50
51 TaggerData &
operator =(TaggerData const & o)52 TaggerData::operator =(TaggerData const &o)
53 {
54 if(this != &o)
55 {
56 copy(o);
57 }
58 return *this;
59 }
60
61 set<TTag> &
getOpenClass()62 TaggerData::getOpenClass()
63 {
64 return open_class;
65 }
66
67 const set<TTag> &
getOpenClass() const68 TaggerData::getOpenClass() const
69 {
70 return open_class;
71 }
72
73 void
setOpenClass(set<TTag> const & oc)74 TaggerData::setOpenClass(set<TTag> const &oc)
75 {
76 open_class = oc;
77 }
78
79 vector<TForbidRule> &
getForbidRules()80 TaggerData::getForbidRules()
81 {
82 return forbid_rules;
83 }
84
85 const vector<TForbidRule> &
getForbidRules() const86 TaggerData::getForbidRules() const
87 {
88 return forbid_rules;
89 }
90
91 void
setForbidRules(vector<TForbidRule> & fr)92 TaggerData::setForbidRules(vector<TForbidRule> &fr)
93 {
94 forbid_rules = fr;
95 }
96
97 map<wstring, TTag, Ltstr> &
getTagIndex()98 TaggerData::getTagIndex()
99 {
100 return tag_index;
101 }
102
103 const map<wstring, TTag, Ltstr> &
getTagIndex() const104 TaggerData::getTagIndex() const
105 {
106 return tag_index;
107 }
108
109 void
setTagIndex(map<wstring,TTag,Ltstr> const & ti)110 TaggerData::setTagIndex(map<wstring, TTag, Ltstr> const &ti)
111 {
112 tag_index = ti;
113 }
114
115 vector<wstring> &
getArrayTags()116 TaggerData::getArrayTags()
117 {
118 return array_tags;
119 }
120
121 const vector<wstring> &
getArrayTags() const122 TaggerData::getArrayTags() const
123 {
124 return array_tags;
125 }
126
127 void
setArrayTags(vector<wstring> const & at)128 TaggerData::setArrayTags(vector<wstring> const &at)
129 {
130 array_tags = at;
131 }
132
133 vector<TEnforceAfterRule> &
getEnforceRules()134 TaggerData::getEnforceRules()
135 {
136 return enforce_rules;
137 }
138
139 const vector<TEnforceAfterRule> &
getEnforceRules() const140 TaggerData::getEnforceRules() const
141 {
142 return enforce_rules;
143 }
144
145 void
setEnforceRules(vector<TEnforceAfterRule> const & tear)146 TaggerData::setEnforceRules(vector<TEnforceAfterRule> const &tear)
147 {
148 enforce_rules = tear;
149 }
150
151 vector<wstring> &
getPreferRules()152 TaggerData::getPreferRules()
153 {
154 return prefer_rules;
155 }
156
157 const vector<wstring> &
getPreferRules() const158 TaggerData::getPreferRules() const
159 {
160 return prefer_rules;
161 }
162
163 void
setPreferRules(vector<wstring> const & pr)164 TaggerData::setPreferRules(vector<wstring> const &pr)
165 {
166 prefer_rules = pr;
167 }
168
169 vector<wstring> &
getDiscardRules()170 TaggerData::getDiscardRules()
171 {
172 return discard;
173 }
174
175 const vector<wstring> &
getDiscardRules() const176 TaggerData::getDiscardRules() const
177 {
178 return discard;
179 }
180
181 void
setDiscardRules(vector<wstring> const & v)182 TaggerData::setDiscardRules(vector<wstring> const &v)
183 {
184 discard = v;
185 }
186
187 ConstantManager &
getConstants()188 TaggerData::getConstants()
189 {
190 return constants;
191 }
192
193 void
setConstants(ConstantManager const & c)194 TaggerData::setConstants(ConstantManager const &c)
195 {
196 constants = c;
197 }
198
199 Collection &
getOutput()200 TaggerData::getOutput()
201 {
202 return output;
203 }
204
205 const Collection &
getOutput() const206 TaggerData::getOutput() const
207 {
208 return output;
209 }
210
211 void
setOutput(Collection const & c)212 TaggerData::setOutput(Collection const &c)
213 {
214 output = c;
215 }
216
217 PatternList &
getPatternList()218 TaggerData::getPatternList()
219 {
220 return plist;
221 }
222
223 const PatternList &
getPatternList() const224 TaggerData::getPatternList() const
225 {
226 return plist;
227 }
228
229 void
setPatternList(PatternList const & pl)230 TaggerData::setPatternList(PatternList const &pl)
231 {
232 plist = pl;
233 }
234
235 void
addDiscard(wstring const & tags)236 TaggerData::addDiscard(wstring const &tags)
237 {
238 discard.push_back(tags);
239 }
240