@ozgurguler/trnorm 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +71 -2
- package/index.d.ts +30 -0
- package/package.json +49 -4
- package/src/case_tables.js +89 -0
- package/src/casing.js +34 -0
- package/src/index.js +19 -0
- package/src/itn.js +255 -0
- package/src/lexicon.js +489 -0
- package/src/normalizer.js +1513 -0
- package/src/numbers.js +325 -0
- package/src/py.js +438 -0
- package/src/unassigned.js +100 -0
package/src/lexicon.js
ADDED
|
@@ -0,0 +1,489 @@
|
|
|
1
|
+
// trnorm/lexicon.py in JavaScript: the word lists used by the normalizer, entry for entry.
|
|
2
|
+
// A Python dict is a Map (insertion order kept, and no inherited keys: a word like "constructor" is not an entry),
|
|
3
|
+
// a set is a Set, a tuple or list an array.
|
|
4
|
+
|
|
5
|
+
const dict = (entries) => new Map(Object.entries(entries)); // no key here looks like an array index, so order holds
|
|
6
|
+
|
|
7
|
+
export const MONTHS = [
|
|
8
|
+
'',
|
|
9
|
+
'Ocak',
|
|
10
|
+
'Şubat',
|
|
11
|
+
'Mart',
|
|
12
|
+
'Nisan',
|
|
13
|
+
'Mayıs',
|
|
14
|
+
'Haziran',
|
|
15
|
+
'Temmuz',
|
|
16
|
+
'Ağustos',
|
|
17
|
+
'Eylül',
|
|
18
|
+
'Ekim',
|
|
19
|
+
'Kasım',
|
|
20
|
+
'Aralık',
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
// Letter names used when spelling acronyms (TBMM -> te be me me).
|
|
24
|
+
export const LETTER_NAMES = dict({
|
|
25
|
+
'A': 'a', 'B': 'be', 'C': 'ce', 'Ç': 'çe', 'D': 'de', 'E': 'e', 'F': 'fe',
|
|
26
|
+
'G': 'ge', 'Ğ': 'yumuşak ge', 'H': 'he', 'I': 'ı', 'İ': 'i', 'J': 'je',
|
|
27
|
+
'K': 'ka', 'L': 'le', 'M': 'me', 'N': 'ne', 'O': 'o', 'Ö': 'ö', 'P': 'pe',
|
|
28
|
+
'Q': 'kü', 'R': 're', 'S': 'se', 'Ş': 'şe', 'T': 'te', 'U': 'u', 'Ü': 'ü',
|
|
29
|
+
'V': 've', 'W': 'çift ve', 'X': 'iks', 'Y': 'ye', 'Z': 'ze',
|
|
30
|
+
'Â': 'a', 'Î': 'i', 'Û': 'u',
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// Acronyms whose usual reading differs from plain spelling / plain word reading.
|
|
34
|
+
export const ACRONYMS = dict({
|
|
35
|
+
'THY': 'te ha ye',
|
|
36
|
+
'HDP': 'ha de pe',
|
|
37
|
+
'AKP': 'a ka pe',
|
|
38
|
+
'AK': 'ak',
|
|
39
|
+
'CHP': 'ce he pe',
|
|
40
|
+
'MHP': 'me he pe',
|
|
41
|
+
'NTV': 'en te ve',
|
|
42
|
+
'CNN': 'si en en',
|
|
43
|
+
'BBC': 'bi bi si',
|
|
44
|
+
'CEO': 'si i o',
|
|
45
|
+
'DİSK': 'disk',
|
|
46
|
+
'TOGG': 'tog',
|
|
47
|
+
'WC': 've ce',
|
|
48
|
+
'COVID': 'kovid',
|
|
49
|
+
'UNICEF': 'yunisef',
|
|
50
|
+
'RTÜK': 're te ü ka',
|
|
51
|
+
'İTÜ': 'i te ü',
|
|
52
|
+
'YTÜ': 'ye te ü',
|
|
53
|
+
'KTÜ': 'ka te ü',
|
|
54
|
+
'ODTÜ': 'o de te ü',
|
|
55
|
+
'MS': 'milattan sonra',
|
|
56
|
+
'MÖ': 'milattan önce',
|
|
57
|
+
'TL': 'te le',
|
|
58
|
+
'IMF': 'ay em ef',
|
|
59
|
+
'AI': 'ey ay',
|
|
60
|
+
'PhD': 'pi eyç di',
|
|
61
|
+
'OK': 'okey',
|
|
62
|
+
'SOS': 'es o es',
|
|
63
|
+
'FBI': 'ef bi ay',
|
|
64
|
+
'CIA': 'si ay ey',
|
|
65
|
+
'UFO': 'ufo',
|
|
66
|
+
'LGBT': 'le ge be te',
|
|
67
|
+
'WWE': 'dabılyu dabılyu i',
|
|
68
|
+
'HTML': 'he te me le',
|
|
69
|
+
'CSS': 'ce se se',
|
|
70
|
+
'API': 'a pe i',
|
|
71
|
+
'URL': 'u re le',
|
|
72
|
+
'VIP': 'vip',
|
|
73
|
+
'IBAN': 'iban',
|
|
74
|
+
'SMS': 'esemes',
|
|
75
|
+
'FAST': 'fast',
|
|
76
|
+
'SIM': 'sim',
|
|
77
|
+
'POS': 'pos',
|
|
78
|
+
'MHRS': 'me he re se',
|
|
79
|
+
'PIN': 'pin',
|
|
80
|
+
'OTP': 'o te pe',
|
|
81
|
+
'IKEA': 'ikea',
|
|
82
|
+
'QR': 'kü ar',
|
|
83
|
+
'LC': 'el si',
|
|
84
|
+
'ISBN': 'i se be ne',
|
|
85
|
+
'IQ': 'ay kü',
|
|
86
|
+
'IP': 'i pe',
|
|
87
|
+
'IT': 'ay ti',
|
|
88
|
+
'ID': 'ay di',
|
|
89
|
+
'ISO': 'iso',
|
|
90
|
+
'BIOS': 'bayos',
|
|
91
|
+
'BIST': 'bist',
|
|
92
|
+
'BİST': 'bist',
|
|
93
|
+
'BMW': 'be me ve',
|
|
94
|
+
'PDF': 'pe de ef',
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// Foreign names (brands, apps, products) and English loanwords whose spelling misleads a Turkish
|
|
98
|
+
// reader, mapped to their usual Turkish pronunciation in lowercase Turkish spelling. normalize()
|
|
99
|
+
// replaces them (the eval form keeps the written word, as ASR output and references do), re-agrees
|
|
100
|
+
// an apostrophe suffix with the pronunciation and keeps a written initial capital:
|
|
101
|
+
// "iPhone'umdan" -> "ayfonumdan", "Google'da" -> "Gugılda", "Instagram" -> "İnstagram".
|
|
102
|
+
// Matching is case-sensitive; besides each key, its ALL-CAPS, all-lowercase and Capitalized forms are
|
|
103
|
+
// matched too ("YOUTUBE", "youtube", "Youtube"), except for the keys in FOREIGN_NAMES_EXACT_CASE.
|
|
104
|
+
// Only names a Turkish reader gets wrong belong here: Trendyol, Getir, Migros, TikTok, Samsung, Amazon,
|
|
105
|
+
// Tesla... read right by Turkish spelling and are left alone. Longest key wins ("Visual Studio Code").
|
|
106
|
+
export const FOREIGN_NAMES = dict({
|
|
107
|
+
// AI
|
|
108
|
+
'ChatGPT': 'çet ci pi ti',
|
|
109
|
+
'OpenAI': 'opın ey ay',
|
|
110
|
+
'Claude': 'klod',
|
|
111
|
+
'Gemini': 'ceminay',
|
|
112
|
+
'Anthropic': 'entropik',
|
|
113
|
+
'Copilot': 'kopaylıt',
|
|
114
|
+
'Codex': 'kodeks',
|
|
115
|
+
'DeepSeek': 'dipsik',
|
|
116
|
+
'Midjourney': 'midcörni',
|
|
117
|
+
'Perplexity': 'pörpleksiti',
|
|
118
|
+
'Hugging Face': 'haging feys',
|
|
119
|
+
'EMA Lightning': 'ema laytning',
|
|
120
|
+
'ema-lightning': 'ema laytning',
|
|
121
|
+
'Lightning': 'laytning',
|
|
122
|
+
// software, developer tools
|
|
123
|
+
'GitHub': 'githab',
|
|
124
|
+
'GitLab': 'gitleb',
|
|
125
|
+
'Docker': 'dokır',
|
|
126
|
+
'Kubernetes': 'kubırnetis',
|
|
127
|
+
'Python': 'paytın',
|
|
128
|
+
'JavaScript': 'cavaskript',
|
|
129
|
+
'TypeScript': 'taypskript',
|
|
130
|
+
'Java': 'cava',
|
|
131
|
+
'React': 'riekt',
|
|
132
|
+
'Rust': 'rast',
|
|
133
|
+
'Linux': 'linuks',
|
|
134
|
+
'Visual Studio Code': 'vijuıl stüdyo kod',
|
|
135
|
+
'Visual Studio': 'vijuıl stüdyo',
|
|
136
|
+
'VS Code': 'vi es kod',
|
|
137
|
+
'Stack Overflow': 'stek ovırflov',
|
|
138
|
+
'Jira': 'cira',
|
|
139
|
+
'Notion': 'noşın',
|
|
140
|
+
'Slack': 'slek',
|
|
141
|
+
'Zoom': 'zum',
|
|
142
|
+
'Microsoft': 'maykrosoft',
|
|
143
|
+
'Windows': 'vindovs',
|
|
144
|
+
'Office': 'ofis',
|
|
145
|
+
'Excel': 'eksel',
|
|
146
|
+
'PowerPoint': 'pavırpoynt',
|
|
147
|
+
'Outlook': 'autluk',
|
|
148
|
+
'Teams': 'tims',
|
|
149
|
+
'OneDrive': 'vandrayv',
|
|
150
|
+
'Xbox': 'eksboks',
|
|
151
|
+
'PlayStation': 'pleysteyşın',
|
|
152
|
+
'Google': 'gugıl',
|
|
153
|
+
'Gmail': 'cimeyl',
|
|
154
|
+
'Chrome': 'krom',
|
|
155
|
+
'Firefox': 'fayırfoks',
|
|
156
|
+
'Google Play Store': 'gugıl pley stor',
|
|
157
|
+
'Google Play': 'gugıl pley',
|
|
158
|
+
'Play Store': 'pley stor',
|
|
159
|
+
'App Store': 'ep stor',
|
|
160
|
+
// devices, platforms
|
|
161
|
+
'Apple': 'epıl',
|
|
162
|
+
'iPhone': 'ayfon',
|
|
163
|
+
'iPad': 'aypad',
|
|
164
|
+
'iCloud': 'ayklaud',
|
|
165
|
+
'iOS': 'ay o es',
|
|
166
|
+
'macOS': 'mek o es',
|
|
167
|
+
'MacBook': 'mekbuk',
|
|
168
|
+
'AirPods': 'erpods',
|
|
169
|
+
'Galaxy': 'geleksi',
|
|
170
|
+
'Huawei': 'huavey',
|
|
171
|
+
'Xiaomi': 'şaomi',
|
|
172
|
+
'NVIDIA': 'envidya',
|
|
173
|
+
'Intel': 'intel', // "Intel": a Latin capital I is not the Turkish ı
|
|
174
|
+
'Bluetooth': 'blutut',
|
|
175
|
+
'Wi-Fi': 'vayfay',
|
|
176
|
+
'WiFi': 'vayfay',
|
|
177
|
+
'Max': 'maks',
|
|
178
|
+
'Plus': 'plas',
|
|
179
|
+
// social, media, services
|
|
180
|
+
'YouTube': 'yutub',
|
|
181
|
+
'WhatsApp': 'vatsap',
|
|
182
|
+
'Instagram': 'instagram', // Latin capital I: "ınstagram" otherwise
|
|
183
|
+
'Facebook': 'feysbuk',
|
|
184
|
+
'Twitter': 'tivitır',
|
|
185
|
+
'LinkedIn': 'linkedin',
|
|
186
|
+
'Snapchat': 'snepçet',
|
|
187
|
+
'Pinterest': 'pintırest',
|
|
188
|
+
'Netflix': 'netfliks',
|
|
189
|
+
'Spotify': 'spotifay',
|
|
190
|
+
'Disney+': 'disni plas',
|
|
191
|
+
'Disney': 'disni',
|
|
192
|
+
'PayPal': 'peypal',
|
|
193
|
+
'Mastercard': 'mastırkard',
|
|
194
|
+
'Airbnb': 'erbienbi',
|
|
195
|
+
'Turkcell': 'türksel',
|
|
196
|
+
'Vodafone': 'vodafon',
|
|
197
|
+
// food, retail, cars
|
|
198
|
+
'Coca-Cola': 'koka kola',
|
|
199
|
+
'Coca Cola': 'koka kola',
|
|
200
|
+
'McDonald\'s': 'mekdonılds',
|
|
201
|
+
'McDonalds': 'mekdonılds',
|
|
202
|
+
'Burger King': 'börgır king',
|
|
203
|
+
'Starbucks': 'starbaks',
|
|
204
|
+
'Nescafé': 'neskafe',
|
|
205
|
+
'Nescafe': 'neskafe',
|
|
206
|
+
'Nike': 'nayki',
|
|
207
|
+
'Waikiki': 'vaykiki', // "LC Waikiki": LC is an acronym
|
|
208
|
+
'Mercedes-Benz': 'mersedes benz',
|
|
209
|
+
'Mercedes': 'mersedes',
|
|
210
|
+
'Volkswagen': 'folksvagen',
|
|
211
|
+
'Renault': 'reno',
|
|
212
|
+
'Peugeot': 'pejo',
|
|
213
|
+
'Citroën': 'sitroen',
|
|
214
|
+
'Citroen': 'sitroen',
|
|
215
|
+
'Chevrolet': 'şevrole',
|
|
216
|
+
'Porsche': 'porşe',
|
|
217
|
+
'Jeep': 'cip',
|
|
218
|
+
'Range Rover': 'reync rovır',
|
|
219
|
+
'Land Rover': 'lend rovır',
|
|
220
|
+
// English loanwords of office and internet talk ("Online meeting'e", "feature'ı deploy etmek")
|
|
221
|
+
'online': 'onlayn',
|
|
222
|
+
'offline': 'oflayn',
|
|
223
|
+
'meeting': 'miting',
|
|
224
|
+
'e-mail': 'imeyl',
|
|
225
|
+
'email': 'imeyl',
|
|
226
|
+
'mail': 'meyl',
|
|
227
|
+
'forward': 'forvırd',
|
|
228
|
+
'feature': 'fiçır',
|
|
229
|
+
'deploy': 'diploy',
|
|
230
|
+
'update': 'apdeyt',
|
|
231
|
+
'upgrade': 'apgreyd',
|
|
232
|
+
'download': 'davnlod',
|
|
233
|
+
'upload': 'aplod',
|
|
234
|
+
'feedback': 'fidbek',
|
|
235
|
+
'deadline': 'dedlayn',
|
|
236
|
+
'brief': 'brif',
|
|
237
|
+
'team': 'tim',
|
|
238
|
+
'weekend': 'vikend',
|
|
239
|
+
'laptop': 'leptop',
|
|
240
|
+
'software': 'softver',
|
|
241
|
+
'hardware': 'hardver',
|
|
242
|
+
'startup': 'startap',
|
|
243
|
+
'influencer': 'influensır',
|
|
244
|
+
'podcast': 'podkast',
|
|
245
|
+
'streaming': 'striming',
|
|
246
|
+
'story': 'stori',
|
|
247
|
+
'follower': 'folovır',
|
|
248
|
+
'password': 'pasvord',
|
|
249
|
+
'browser': 'bravzır',
|
|
250
|
+
'server': 'sörvır',
|
|
251
|
+
'backend': 'bekend',
|
|
252
|
+
'debug': 'dibag',
|
|
253
|
+
'release': 'rilis',
|
|
254
|
+
'commit': 'komit',
|
|
255
|
+
'chat': 'çet',
|
|
256
|
+
'gaming': 'geyming',
|
|
257
|
+
'cloud': 'klaud',
|
|
258
|
+
});
|
|
259
|
+
// keys matched only as written and in Latin ALL CAPS ("GEMINI", not the Turkish "GEMİNİ"): their lowercase
|
|
260
|
+
// form is an ordinary English word, or a Turkish one ("gemini terk etme": gemi + n + i)
|
|
261
|
+
export const FOREIGN_NAMES_EXACT_CASE = new Set([
|
|
262
|
+
'React', 'Rust', 'Java', 'Office', 'Teams', 'Plus', 'Lightning', 'Gemini',
|
|
263
|
+
]);
|
|
264
|
+
|
|
265
|
+
// Short Turkish words that appear in ALL-CAPS headlines and must not be spelled.
|
|
266
|
+
export const CAPS_WORDS = new Set([
|
|
267
|
+
'VE', 'DE', 'DA', 'BU', 'ŞU', 'Mİ', 'MI', 'MU', 'MÜ', 'NE', 'EN', 'İLE',
|
|
268
|
+
'Kİ', 'YA', 'AMA', 'BİR', 'İKİ', 'ÜÇ', 'SON', 'İLK', 'HER', 'HİÇ', 'YOK',
|
|
269
|
+
'VAR', 'ÇOK', 'AZ', 'İÇ', 'DIŞ', 'BEN', 'SEN', 'BİZ', 'SİZ', 'ŞOK', 'ÖN',
|
|
270
|
+
'AÇ', 'AT', 'AL', 'VER', 'GEL', 'GİT', 'OL', 'YAP', 'UN', 'SU', 'ON', 'AY',
|
|
271
|
+
'YIL', 'GÜN', 'İŞ', 'EV', 'EL', 'AN', 'ÖZ',
|
|
272
|
+
]);
|
|
273
|
+
|
|
274
|
+
// Dotted / colon abbreviations (case-sensitive). Longest match wins.
|
|
275
|
+
export const ABBREVIATIONS = dict({
|
|
276
|
+
'Prof. Dr.': 'profesör doktor',
|
|
277
|
+
'Doç. Dr.': 'doçent doktor',
|
|
278
|
+
'Yrd. Doç. Dr.': 'yardımcı doçent doktor',
|
|
279
|
+
'Dr. Öğr. Üyesi': 'doktor öğretim üyesi',
|
|
280
|
+
'Öğr. Gör.': 'öğretim görevlisi',
|
|
281
|
+
'Arş. Gör.': 'araştırma görevlisi',
|
|
282
|
+
'Uzm. Dr.': 'uzman doktor',
|
|
283
|
+
'Op. Dr.': 'operatör doktor',
|
|
284
|
+
'Yrd. Doç.': 'yardımcı doçent',
|
|
285
|
+
'Ltd. Şti.': 'limitet şirketi',
|
|
286
|
+
'San. ve Tic.': 'sanayi ve ticaret',
|
|
287
|
+
'Tic. Ltd. Şti.': 'ticaret limitet şirketi',
|
|
288
|
+
'T.C.': 'te ce',
|
|
289
|
+
'A.Ş.': 'anonim şirketi',
|
|
290
|
+
'M.Ö.': 'milattan önce',
|
|
291
|
+
'M.S.': 'milattan sonra',
|
|
292
|
+
'Prof.': 'profesör',
|
|
293
|
+
'Doç.': 'doçent',
|
|
294
|
+
'Dr.': 'doktor',
|
|
295
|
+
'Av.': 'avukat',
|
|
296
|
+
'Uzm.': 'uzman',
|
|
297
|
+
'Müh.': 'mühendis',
|
|
298
|
+
'Hz.': 'hazreti',
|
|
299
|
+
'Sn.': 'sayın',
|
|
300
|
+
'Alb.': 'albay',
|
|
301
|
+
'Yzb.': 'yüzbaşı',
|
|
302
|
+
'Bşk.': 'başkanı',
|
|
303
|
+
'Gn.': 'genel',
|
|
304
|
+
'Md.': 'müdürü',
|
|
305
|
+
'Mah.': 'mahallesi',
|
|
306
|
+
'Mh.': 'mahallesi',
|
|
307
|
+
'Cad.': 'caddesi',
|
|
308
|
+
'Cd.': 'caddesi',
|
|
309
|
+
'Sok.': 'sokak',
|
|
310
|
+
'Sk.': 'sokak',
|
|
311
|
+
'Bulv.': 'bulvarı',
|
|
312
|
+
'Blv.': 'bulvarı',
|
|
313
|
+
'Apt.': 'apartmanı',
|
|
314
|
+
'Ap.': 'apartmanı',
|
|
315
|
+
'Şti.': 'şirketi',
|
|
316
|
+
'Ltd.': 'limitet',
|
|
317
|
+
'Tic.': 'ticaret',
|
|
318
|
+
'San.': 'sanayi',
|
|
319
|
+
'vb.': 've benzeri',
|
|
320
|
+
'vs.': 'vesaire',
|
|
321
|
+
'vd.': 've diğerleri',
|
|
322
|
+
'bkz.': 'bakınız',
|
|
323
|
+
'Bkz.': 'bakınız',
|
|
324
|
+
'örn.': 'örneğin',
|
|
325
|
+
'Örn.': 'örneğin',
|
|
326
|
+
'yy.': 'yüzyıl',
|
|
327
|
+
'yak.': 'yaklaşık',
|
|
328
|
+
'ort.': 'ortalama',
|
|
329
|
+
'maks.': 'maksimum',
|
|
330
|
+
'Tel.': 'telefon',
|
|
331
|
+
'No.': 'numara',
|
|
332
|
+
'Nu.': 'numara',
|
|
333
|
+
'No:': 'numara:',
|
|
334
|
+
'Tel:': 'telefon:',
|
|
335
|
+
'Faks:': 'faks:',
|
|
336
|
+
'Fax:': 'faks:',
|
|
337
|
+
'GSM:': 'ge se me:',
|
|
338
|
+
});
|
|
339
|
+
// abbreviations that can also end a sentence (their period doubles as a full stop)
|
|
340
|
+
export const SENTENCE_FINAL_ABBR = new Set(['vb.', 'vs.', 'vd.', 'yy.', 'A.Ş.', 'Şti.', 'Ltd.', 'M.Ö.', 'M.S.']);
|
|
341
|
+
|
|
342
|
+
export const CURRENCY_WORDS = dict({
|
|
343
|
+
'TL': 'lira', '₺': 'lira', 'TRY': 'lira', 'lira': 'lira',
|
|
344
|
+
'$': 'dolar', 'USD': 'dolar', 'dolar': 'dolar',
|
|
345
|
+
'€': 'avro', 'EUR': 'avro', 'avro': 'avro', 'euro': 'avro', 'Euro': 'avro',
|
|
346
|
+
'£': 'sterlin', 'GBP': 'sterlin', 'sterlin': 'sterlin',
|
|
347
|
+
'¥': 'yen', 'JPY': 'yen',
|
|
348
|
+
'₽': 'ruble', 'RUB': 'ruble',
|
|
349
|
+
'CHF': 'isviçre frangı',
|
|
350
|
+
});
|
|
351
|
+
// currency -> subunit name used for two-digit decimals
|
|
352
|
+
export const CURRENCY_SUBUNIT = dict({ 'lira': 'kuruş', 'dolar': 'sent', 'avro': 'sent', 'sterlin': 'peni' });
|
|
353
|
+
|
|
354
|
+
export const UNITS = dict({
|
|
355
|
+
// length / area / volume
|
|
356
|
+
'km': 'kilometre', 'm': 'metre', 'cm': 'santimetre', 'mm': 'milimetre',
|
|
357
|
+
'µm': 'mikrometre', 'μm': 'mikrometre', 'nm': 'nanometre',
|
|
358
|
+
'km²': 'kilometrekare', 'km2': 'kilometrekare', 'm²': 'metrekare', 'm2': 'metrekare',
|
|
359
|
+
'cm²': 'santimetrekare', 'm³': 'metreküp', 'm3': 'metreküp', 'cm³': 'santimetreküp',
|
|
360
|
+
'cc': 'santimetreküp', 'ha': 'hektar', 'dönüm': 'dönüm',
|
|
361
|
+
// mass
|
|
362
|
+
'kg': 'kilogram', 'g': 'gram', 'gr': 'gram', 'mg': 'miligram', 'µg': 'mikrogram',
|
|
363
|
+
'mcg': 'mikrogram', 'ton': 'ton',
|
|
364
|
+
// volume
|
|
365
|
+
'lt': 'litre', 'l': 'litre', 'L': 'litre', 'ml': 'mililitre', 'mL': 'mililitre', 'cl': 'santilitre',
|
|
366
|
+
// time
|
|
367
|
+
'sn': 'saniye', 'sn.': 'saniye', 'dk': 'dakika', 'dk.': 'dakika', 'dak': 'dakika',
|
|
368
|
+
'sa': 'saat', 'ms': 'milisaniye',
|
|
369
|
+
// energy / electricity / frequency
|
|
370
|
+
'kWh': 'kilovatsaat', 'kW': 'kilovat', 'MW': 'megavat', 'GW': 'gigavat', 'W': 'vat',
|
|
371
|
+
'V': 'volt', 'mV': 'milivolt', 'kV': 'kilovolt', 'mA': 'miliamper', 'mAh': 'miliamper saat',
|
|
372
|
+
'Hz': 'hertz', 'kHz': 'kilohertz', 'MHz': 'megahertz', 'GHz': 'gigahertz',
|
|
373
|
+
'dB': 'desibel', 'kcal': 'kilokalori', 'cal': 'kalori', 'bar': 'bar', 'rpm': 'devir',
|
|
374
|
+
// data
|
|
375
|
+
'KB': 'kilobayt', 'kB': 'kilobayt', 'MB': 'megabayt', 'GB': 'gigabayt', 'TB': 'terabayt',
|
|
376
|
+
'Mbps': 'megabit', 'Gbps': 'gigabit', 'px': 'piksel', 'MP': 'megapiksel',
|
|
377
|
+
'mmHg': 'milimetre cıva',
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
// speed units are read "saatte 120 kilometre"
|
|
381
|
+
export const SPEED_UNITS = dict({
|
|
382
|
+
'km/sa': ['saatte', 'kilometre'],
|
|
383
|
+
'km/s': ['saatte', 'kilometre'],
|
|
384
|
+
'km/h': ['saatte', 'kilometre'],
|
|
385
|
+
'm/sn': ['saniyede', 'metre'],
|
|
386
|
+
'm/s': ['saniyede', 'metre'],
|
|
387
|
+
});
|
|
388
|
+
|
|
389
|
+
// words that, among the last three before a 5+ digit number, mark it as an identifier (read in digit
|
|
390
|
+
// groups). A cue matches as a whole word or with nominal suffixes ("numaranız", "kodu", "hesabınız"), never
|
|
391
|
+
// as the start of another word ("normalde", "televizyonda", "kartal", "takipçi")
|
|
392
|
+
export const ID_CONTEXT = [
|
|
393
|
+
'numara', 'no', 'sipariş', 'takip', 'kod', 'hesap', 'hesab', 'kimlik', 'kimliğ',
|
|
394
|
+
'tc', 'iban', 'ıban', 'telefon', 'tel', 'gsm', 'hat', 'hatt', 'fatura', 'referans', 'pnr',
|
|
395
|
+
'seri', 'şifre', 'pin', 'pın', 'posta', 'plaka', 'müşteri', 'abone', 'sicil', 'dosya',
|
|
396
|
+
'poliçe', 'kart', 'başvuru', 'rezervasyon', 'barkod', 'ürün',
|
|
397
|
+
];
|
|
398
|
+
// cues that match only as whole words: "hat" (not "hata", "hatta", "Hatay"), "seri" (not "serin")
|
|
399
|
+
export const ID_EXACT = new Set(['no', 'tc', 'tel', 'gsm', 'hat', 'pin', 'pın', 'pnr', 'seri', 'otp']);
|
|
400
|
+
// ...but a count is not an identifier: the word right before it names a quantity ("Müşteri sayısı 25000"),
|
|
401
|
+
// or the word after it is a unit or a counted noun ("Telefonla 15000 kişiye", "Vergi borcu 25000 lira")
|
|
402
|
+
export const QUANTITY_BEFORE = new Set([
|
|
403
|
+
'sayı', 'sayısı', 'adet', 'adedi', 'tutar', 'tutarı', 'borç', 'borcu', 'limit', 'limiti', 'miktar',
|
|
404
|
+
'miktarı', 'bedel', 'bedeli', 'ücret', 'ücreti', 'fiyat', 'fiyatı', 'bakiye', 'bakiyesi', 'toplam',
|
|
405
|
+
'toplamı', 'değer', 'değeri',
|
|
406
|
+
]);
|
|
407
|
+
export const QUANTITY_AFTER = [
|
|
408
|
+
'kişi', 'adet', 'tane', 'lira', 'kuruş', 'dolar', 'avro', 'euro', 'sterlin', 'yıl', 'gün', 'hafta', 'saat',
|
|
409
|
+
'dakika', 'saniye', 'metre', 'kilometre', 'kilo', 'kilogram', 'gram', 'ton', 'litre', 'kez', 'defa',
|
|
410
|
+
'personel', 'çalışan', 'öğrenci', 'üye', 'takipçi', 'abone', 'başvuru', 'konut', 'araç', 'bit', 'bayt',
|
|
411
|
+
];
|
|
412
|
+
|
|
413
|
+
// capitalized words after which "N." is still an ordinal ("3. Lig", "II. Dünya Savaşı")
|
|
414
|
+
export const ORDINAL_CAP_NOUNS = new Set([
|
|
415
|
+
'Lig', 'Dünya', 'Ordu', 'Kolordu', 'Tümen', 'Cadde', 'Sokak', 'Bölge', 'Sınıf', 'Kat',
|
|
416
|
+
'Murat', 'Selim', 'Mehmet', 'Ahmet', 'Mahmut', 'Abdülhamit', 'Abdülhamid', 'Bayezid',
|
|
417
|
+
'Beyazıt', 'Mustafa', 'Osman', 'Süleyman', 'Dönem', 'Yasama', 'Meclis', 'Ulusal',
|
|
418
|
+
'Uluslararası', 'Asliye', 'Ağır', 'İdare', 'Sulh', 'İcra', 'Noter', 'Etap', 'Kısım',
|
|
419
|
+
'Bölüm', 'Ünite', 'Sezon', 'Hafta', 'Tur', 'Yıl', 'Baskı', 'Cilt', 'Kitap', 'Madde',
|
|
420
|
+
'Fıkra', 'Bent', 'Ordusu', 'Filo', 'Tugay', 'Alay', 'Lige', 'Ligde', 'Dünya\'da',
|
|
421
|
+
'Kongre', 'Kurultay', 'Olağan', 'Olağanüstü', 'Festival', 'Uluslararası', 'Yüzyıl',
|
|
422
|
+
'Murad', 'Mehmed', 'Ahmed', 'Mahmud', 'Orhan', 'Abdülaziz', 'Abdülmecid', 'Abdülmecit',
|
|
423
|
+
'Louis', 'Charles', 'Henry', 'George', 'Edward', 'Elizabeth', 'Wilhelm', 'Friedrich',
|
|
424
|
+
'Frederick', 'Ferdinand', 'Karl', 'Carlos', 'Felipe', 'Napolyon', 'Petro', 'Katerina',
|
|
425
|
+
'Nikola', 'Aleksandr', 'Konstantin', 'Leo', 'Pius', 'Paul', 'John', 'Juan',
|
|
426
|
+
'Daire', 'Derece', 'Kademe', 'Grup', 'Hukuk', 'Ceza', 'Haçlı', 'Kalkınma',
|
|
427
|
+
]);
|
|
428
|
+
|
|
429
|
+
// inflected forms of ORDINAL_CAP_NOUNS: "XX. Yüzyılda", "3. Ligde"
|
|
430
|
+
export const ORDINAL_CAP_PREFIXES = ['Yüzyıl', 'Dünya', 'Lig'];
|
|
431
|
+
|
|
432
|
+
// titles (as written or as read out) after which a lone I. or X. is an initial, not an ordinal:
|
|
433
|
+
// "Dr. I. Yılmaz", "Av. X. Demir" (a lone V. is an initial unless a lowercase word or an
|
|
434
|
+
// ORDINAL_CAP_NOUNS word follows: "V. Öztürk", "V. Murat")
|
|
435
|
+
export const INITIAL_TITLES = [
|
|
436
|
+
'dr', 'doktor', 'prof', 'profesör', 'doç', 'doçent', 'av', 'avukat', 'op', 'operatör', 'uzm', 'uzman',
|
|
437
|
+
'müh', 'mühendis', 'sn', 'sayın', 'bay', 'bayan', 'mr', 'mrs', 'ms', 'görevlisi', 'üyesi', 'hazreti',
|
|
438
|
+
];
|
|
439
|
+
|
|
440
|
+
// accept these lowercase suffixes on a number even without an apostrophe ("1990larda")
|
|
441
|
+
export const BARE_NUMBER_SUFFIXES = new Set([
|
|
442
|
+
'de', 'da', 'te', 'ta', 'den', 'dan', 'ten', 'tan', 'deki', 'daki', 'teki', 'taki',
|
|
443
|
+
'e', 'a', 'ye', 'ya', 'i', 'ı', 'u', 'ü', 'yi', 'yı', 'yu', 'yü',
|
|
444
|
+
'in', 'ın', 'un', 'ün', 'nin', 'nın', 'nun', 'nün',
|
|
445
|
+
'le', 'la', 'yle', 'yla', 'ler', 'lar', 'lerde', 'larda', 'lerden', 'lardan',
|
|
446
|
+
'lere', 'lara', 'leri', 'ları', 'lerin', 'ların', 'li', 'lı', 'lu', 'lü',
|
|
447
|
+
'lik', 'lık', 'luk', 'lük', 'er', 'ar', 'şer', 'şar',
|
|
448
|
+
'inci', 'ıncı', 'uncu', 'üncü', 'nci', 'ncı', 'ncu', 'ncü',
|
|
449
|
+
]);
|
|
450
|
+
|
|
451
|
+
// words right before "N/M" that make it an address number ("No: 12/4", "Daire 3/1", "kapı no 15/3"),
|
|
452
|
+
// read "on iki bölü dört" rather than a date or a fraction; also "N/M nolu"
|
|
453
|
+
export const ADDRESS_NUMBER_CONTEXT = new Set([
|
|
454
|
+
'no', 'nu', 'numara', 'numarası', 'numaralı', 'kapı', 'daire', 'dairesi', 'kat', 'blok', 'bina',
|
|
455
|
+
'apt', 'apartman', 'apartmanı', 'cadde', 'caddesi', 'sokak', 'sokağı', 'bulvar', 'bulvarı',
|
|
456
|
+
]);
|
|
457
|
+
// whole words that mark an address (not "katılan", "kategori", "mahallede", "postaneye"): a bare 5-digit
|
|
458
|
+
// number in one, before a place name, is a postcode read digit by digit ("..., 34728 Kadıköy")
|
|
459
|
+
export const ADDRESS_CONTEXT = new Set([
|
|
460
|
+
'adres', 'adresi', 'adresim', 'adresimiz', 'adresiniz', 'mahalle', 'mahallesi', 'mah', 'mh', 'cadde',
|
|
461
|
+
'caddesi', 'cad', 'cd', 'sokak', 'sokağı', 'sok', 'sk', 'bulvar', 'bulvarı', 'bulv', 'blv', 'no', 'nu',
|
|
462
|
+
'numara', 'numarası', 'kapı', 'daire', 'dairesi', 'kat', 'apartman', 'apartmanı', 'apt', 'ap', 'blok',
|
|
463
|
+
'site', 'sitesi', 'posta',
|
|
464
|
+
]);
|
|
465
|
+
|
|
466
|
+
export const SCORE_CONTEXT = [
|
|
467
|
+
'yendi', 'mağlup', 'skor', 'skorla', 'galip', 'berabere', 'maç', 'maçı', 'maçta',
|
|
468
|
+
'set', 'seti', 'galibiyet', 'yenilgi', 'kazandı', 'kaybetti', 'durumunda', 'farkla',
|
|
469
|
+
];
|
|
470
|
+
|
|
471
|
+
export const TIME_CONTEXT = [
|
|
472
|
+
'saat', 'sabah', 'akşam', 'öğle', 'öğlen', 'öğleden', 'gece', 'itibaren', 'kadar',
|
|
473
|
+
'sularında', 'civarında', 'arası', 'arasında', 'randevu', 'seans',
|
|
474
|
+
];
|
|
475
|
+
|
|
476
|
+
// one-time codes and PINs are read digit by digit even when short ("kodunuz 4821", "Onay kodu 4821");
|
|
477
|
+
// matched like ID_CONTEXT, so "Kodlama 2026 yılında" and "Onaylanan 2500 başvuru" stay numbers
|
|
478
|
+
export const CODE_CONTEXT = ['kod', 'şifre', 'pin', 'pın', 'otp', 'doğrulama']; // "pın": "PIN" in Turkish lowercase
|
|
479
|
+
|
|
480
|
+
// Acronyms that are spelled out when read. normalize_for_eval() also recognizes their
|
|
481
|
+
// lowercase spelling ("abd", "tbmm") so that lowercase ASR output and references score
|
|
482
|
+
// the same as "ABD", "TBMM". Only tokens that are not ordinary Turkish words belong here.
|
|
483
|
+
export const EVAL_ACRONYMS = new Set([
|
|
484
|
+
'ABD', 'AB', 'BM', 'TBMM', 'CHP', 'AKP', 'MHP', 'HDP', 'DEM', 'SGK', 'KDV', 'ÖTV', 'TL', 'TRT', 'PTT',
|
|
485
|
+
'THY', 'TCDD', 'TC', 'AVM', 'ATM', 'SMS', 'PDF', 'USB', 'GPS', 'DNA', 'MR', 'EKG', 'AİHM', 'AYM',
|
|
486
|
+
'YSK', 'ÖSYM', 'YKS', 'LGS', 'KPSS', 'TSK', 'TÜİK', 'BDDK', 'SPK', 'TCMB', 'İBB', 'İETT', 'ABB',
|
|
487
|
+
'PKK', 'IMF', 'NBA', 'CEO', 'TV', 'KKTC', 'AİHS', 'HSK', 'MSB', 'EGM', 'BTK', 'EPDK', 'RTÜK', 'KOBİ',
|
|
488
|
+
'SSK', 'TMSF', 'KVKK', 'EFT', 'TBB', 'TFF', 'UEFA', 'FIFA', 'NATO', 'AFAD', 'MEB', 'YÖK', 'MİT',
|
|
489
|
+
]);
|