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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
|
#include "sentbreakfilter.h"
static const char* COMMON_ABBREVIATIONS_NEVER_BREAK[] = {
"агр",
"акад",
"ал",
"алл",
"арх",
"асс",
"б-р",
"бол",
"бул",
"бульв",
"вл",
"верхн",
"вып",
"гг",
"ген",
"гр",
"деп",
"дер",
"дир",
"дор",
"доц",
"зав",
"зам",
"им",
"канд",
"каб",
"кв",
"кв-л",
"км",
"кн",
"корп",
"корр",
"кр",
"лит",
"маг",
"м-н",
"мех",
"мин",
"мкр",
"наб",
"напр",
"нов",
"нс",
"пав",
"пер",
"пер-к",
"пл",
"пос",
"пп",
"пр",
"пр-д",
"пр-зд",
"пр-т",
"пр-кт",
"просп",
"проф",
"ред",
"св",
"см",
"сов",
"спец",
"ср",
"ст",
"твц",
"тоц",
"трк",
"тц",
"тeх",
"техн",
"тов",
"тт",
"туп",
"укр",
"ул",
"чл",
"эт",
"co",
"corp",
"dr",
"inc",
"ltd",
"mr",
"mrs",
"ms",
"st",
"vs"};
static const char* DOUBLE_SUBTOKEN_COMMON_ABBREVIATIONS_NEVER_BREAK[] = {
"б-р",
"кв-л",
"м-н",
"пер-к",
"пр-д",
"пр-зд",
"пр-т",
"пр-кт",
"т.е",
};
static const char* COMMON_ABBREVIATIONS_DONT_BREAK_IF_BEFORE_DIGIT[] = {
"авг",
"апр",
"влад",
"гл",
"дек",
"доб",
"ил",
"июл",
"июн",
"кг",
"кл",
"ком",
"кор",
"мар",
"мб",
"млн",
"млрд",
"моб",
"нояб",
"окт",
"оф",
"рис",
"род",
"руб",
"сен",
"сент",
"сот",
"стр",
"табл",
"тел",
"тыс",
"фев",
"шк",
"янв",
"no",
"pp",
"vol"};
static const char* DOUBLE_SUBTOKEN_COMMON_ABBREVIATIONS_DONT_BREAK_IF_BEFORE_DIGIT[] = {
"т/ф",
"тел/ф",
};
static const char* UKR_ABBREVIATIONS_NEVER_BREAK[] = {
"вул",
"ім",
"торг",
"тур"};
static const char* TUR_ABBREVIATIONS_NEVER_BREAK[] = {
"bld",
"blv",
"blvd",
"bul",
"cad",
"dk",
"doç",
"hz",
"inc",
"jr",
"kg",
"mah",
"mh",
"prof",
"sok",
"tel",
"tic",
"vb",
"yard",
"yrd"};
void TAbbreviationsDictionary::AddElements(THashSet<TUtf16String>& hashSet,
const char* elements[],
size_t size) {
size_t length = size / sizeof(char*);
for (size_t i = 0; i != length; ++i) {
TUtf16String str(UTF8ToWide(elements[i]));
Y_ASSERT(hashSet.find(str) == hashSet.end());
hashSet.insert(str);
}
}
TAbbreviationsDictionary::TAbbreviationsDictionary() {
AddElements(NeverBreakSets[LANG_UNK],
COMMON_ABBREVIATIONS_NEVER_BREAK,
sizeof(COMMON_ABBREVIATIONS_NEVER_BREAK));
AddElements(DoubleSubtokenNeverBreakSets[LANG_UNK],
DOUBLE_SUBTOKEN_COMMON_ABBREVIATIONS_NEVER_BREAK,
sizeof(DOUBLE_SUBTOKEN_COMMON_ABBREVIATIONS_NEVER_BREAK));
AddElements(DontBreakIfBeforeDigitSets[LANG_UNK],
COMMON_ABBREVIATIONS_DONT_BREAK_IF_BEFORE_DIGIT,
sizeof(COMMON_ABBREVIATIONS_DONT_BREAK_IF_BEFORE_DIGIT));
AddElements(DoubleSubtokenDontBreakIfBeforeDigitSets[LANG_UNK],
DOUBLE_SUBTOKEN_COMMON_ABBREVIATIONS_DONT_BREAK_IF_BEFORE_DIGIT,
sizeof(DOUBLE_SUBTOKEN_COMMON_ABBREVIATIONS_DONT_BREAK_IF_BEFORE_DIGIT));
AddElements(NeverBreakSets[LANG_UKR],
UKR_ABBREVIATIONS_NEVER_BREAK,
sizeof(UKR_ABBREVIATIONS_NEVER_BREAK));
AddElements(NeverBreakSets[LANG_TUR],
TUR_ABBREVIATIONS_NEVER_BREAK,
sizeof(TUR_ABBREVIATIONS_NEVER_BREAK));
}
|