tdk-api-wrapper 1.0.1

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/dist/cli.js ADDED
@@ -0,0 +1,422 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
18
+ // If the importer is in node compatibility mode or this is not an ESM
19
+ // file that has been converted to a CommonJS file using a Babel-
20
+ // compatible transform (i.e. "__esModule" has not been set), then set
21
+ // "default" to the CommonJS "module.exports" for node compatibility.
22
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
+ mod
24
+ ));
25
+
26
+ // src/tdk.ts
27
+ var fs = __toESM(require("fs"));
28
+ var path = __toESM(require("path"));
29
+ var os = __toESM(require("os"));
30
+ var TDK = class {
31
+ static BASE_URL = "https://sozluk.gov.tr";
32
+ // Cache Mechanism
33
+ static isCacheEnabled = false;
34
+ static wordCache = /* @__PURE__ */ new Map();
35
+ static dailyContentCache = null;
36
+ static autocompleteCache = [];
37
+ /**
38
+ * Enables or disables in-memory caching for API requests.
39
+ */
40
+ static enableCache(status = true) {
41
+ this.isCacheEnabled = status;
42
+ if (!status) {
43
+ this.clearCache();
44
+ }
45
+ }
46
+ /**
47
+ * Clears the internal cache.
48
+ */
49
+ static clearCache() {
50
+ this.wordCache.clear();
51
+ this.dailyContentCache = null;
52
+ this.autocompleteCache = [];
53
+ }
54
+ static delay(ms) {
55
+ return new Promise((resolve) => setTimeout(resolve, ms));
56
+ }
57
+ /**
58
+ * Fetches detailed information for a given word from the TDK Dictionary.
59
+ */
60
+ static async getWord(word2) {
61
+ if (!word2 || word2.trim() === "") {
62
+ throw new Error("Word parameter cannot be empty.");
63
+ }
64
+ const cleanWord = word2.trim().toLowerCase();
65
+ if (this.isCacheEnabled && this.wordCache.has(cleanWord)) {
66
+ return this.wordCache.get(cleanWord);
67
+ }
68
+ const url = `${this.BASE_URL}/gts?ara=${encodeURIComponent(cleanWord)}`;
69
+ try {
70
+ const response = await fetch(url, {
71
+ headers: { "User-Agent": "TDK-API-Nodejs-Wrapper/1.0" }
72
+ });
73
+ if (!response.ok)
74
+ throw new Error(`HTTP error! status: ${response.status}`);
75
+ const data = await response.json();
76
+ if (!Array.isArray(data) && data && "error" in data) {
77
+ if (this.isCacheEnabled)
78
+ this.wordCache.set(cleanWord, []);
79
+ return [];
80
+ }
81
+ const results = data;
82
+ if (this.isCacheEnabled) {
83
+ this.wordCache.set(cleanWord, results);
84
+ }
85
+ return results;
86
+ } catch (error) {
87
+ if (error instanceof Error)
88
+ throw new Error(`Failed to fetch word from TDK: ${error.message}`);
89
+ throw new Error("Failed to fetch word from TDK: Unknown error");
90
+ }
91
+ }
92
+ /**
93
+ * Helper method to get only the meanings (definitions) of a word as a string array.
94
+ */
95
+ static async getMeanings(word2) {
96
+ const results = await this.getWord(word2);
97
+ if (results.length === 0)
98
+ return [];
99
+ const meanings = [];
100
+ for (const result of results) {
101
+ if (result.anlamlarListe) {
102
+ for (const anlam of result.anlamlarListe) {
103
+ if (anlam.anlam)
104
+ meanings.push(anlam.anlam);
105
+ }
106
+ }
107
+ }
108
+ return meanings;
109
+ }
110
+ /**
111
+ * Returns suggestions (autocomplete) for a given prefix.
112
+ */
113
+ static async getSuggestions(prefix) {
114
+ if (this.autocompleteCache.length === 0) {
115
+ try {
116
+ const response = await fetch(`${this.BASE_URL}/autocomplete.json`, {
117
+ headers: { "User-Agent": "TDK-API-Nodejs-Wrapper/1.0" }
118
+ });
119
+ if (response.ok) {
120
+ const data = await response.json();
121
+ this.autocompleteCache = data.map((item) => item.madde);
122
+ }
123
+ } catch (e) {
124
+ return [];
125
+ }
126
+ }
127
+ const cleanPrefix = prefix.toLowerCase();
128
+ return this.autocompleteCache.filter((w) => w.toLowerCase().startsWith(cleanPrefix)).slice(0, 10);
129
+ }
130
+ /**
131
+ * Returns a list of proverbs and idioms containing the word.
132
+ */
133
+ static async getProverbs(word2) {
134
+ const results = await this.getWord(word2);
135
+ if (results.length === 0)
136
+ return [];
137
+ const proverbs = [];
138
+ for (const result of results) {
139
+ if (result.atasozu) {
140
+ for (const atasoz of result.atasozu) {
141
+ if (atasoz.madde)
142
+ proverbs.push(atasoz.madde);
143
+ }
144
+ }
145
+ }
146
+ return proverbs;
147
+ }
148
+ /**
149
+ * Returns the etymological origin of the word if it's a foreign word.
150
+ */
151
+ static async getOrigin(word2) {
152
+ const results = await this.getWord(word2);
153
+ if (results.length > 0 && results[0].lisan) {
154
+ return results[0].lisan;
155
+ }
156
+ return "T\xFCrk\xE7e";
157
+ }
158
+ /**
159
+ * Returns literature examples containing the word.
160
+ */
161
+ static async getExamples(word2) {
162
+ const results = await this.getWord(word2);
163
+ const examples = [];
164
+ for (const result of results) {
165
+ if (result.anlamlarListe) {
166
+ for (const anlam of result.anlamlarListe) {
167
+ if (anlam.orneklerListe) {
168
+ for (const ornek of anlam.orneklerListe) {
169
+ const author = ornek.yazar && ornek.yazar.length > 0 ? ornek.yazar[0].tam_adi : null;
170
+ examples.push({ sentence: ornek.ornek, author });
171
+ }
172
+ }
173
+ }
174
+ }
175
+ }
176
+ return examples;
177
+ }
178
+ /**
179
+ * Returns the direct URL of the audio pronunciation if available.
180
+ * Note: TDK audio URL usually uses the exact audio id. Sometimes it requires MD5, but we provide a common pattern.
181
+ */
182
+ static async getAudioUrl(word2) {
183
+ const results = await this.getWord(word2);
184
+ if (results.length > 0) {
185
+ return `https://sozluk.gov.tr/ses/${encodeURIComponent(word2)}.wav`;
186
+ }
187
+ return null;
188
+ }
189
+ /**
190
+ * Downloads the audio pronunciation to the specified path.
191
+ */
192
+ static async downloadAudio(word2, destPath) {
193
+ const url = await this.getAudioUrl(word2);
194
+ if (!url)
195
+ return null;
196
+ const finalPath = destPath || path.join(os.tmpdir(), `${word2}.wav`);
197
+ try {
198
+ const res = await fetch(url);
199
+ if (!res.ok)
200
+ return null;
201
+ const buffer = await res.arrayBuffer();
202
+ fs.writeFileSync(finalPath, Buffer.from(buffer));
203
+ return finalPath;
204
+ } catch {
205
+ return null;
206
+ }
207
+ }
208
+ /**
209
+ * Checks spelling and returns suggestions if wrong.
210
+ */
211
+ static async checkSpelling(word2) {
212
+ const results = await this.getWord(word2);
213
+ if (results.length > 0) {
214
+ return { isCorrect: true, word: word2 };
215
+ }
216
+ const daily = await this.getDailyContent();
217
+ if (daily) {
218
+ const syydMatch = daily.syyd.find((s) => s.yanliskelime.toLowerCase() === word2.toLowerCase());
219
+ if (syydMatch) {
220
+ return { isCorrect: false, word: word2, suggestion: syydMatch.dogrukelime };
221
+ }
222
+ const mixMatch = daily.karistirma.find((s) => s.yanlis.toLowerCase() === word2.toLowerCase());
223
+ if (mixMatch) {
224
+ return { isCorrect: false, word: word2, suggestion: mixMatch.dogru };
225
+ }
226
+ }
227
+ return { isCorrect: false, word: word2 };
228
+ }
229
+ /**
230
+ * Fetches daily content (word of the day, proverbs, rules, etc).
231
+ */
232
+ static async getDailyContent() {
233
+ if (this.isCacheEnabled && this.dailyContentCache)
234
+ return this.dailyContentCache;
235
+ try {
236
+ const response = await fetch(`${this.BASE_URL}/icerik`, {
237
+ headers: { "User-Agent": "TDK-API-Nodejs-Wrapper/1.0" }
238
+ });
239
+ if (response.ok) {
240
+ const data = await response.json();
241
+ if (this.isCacheEnabled)
242
+ this.dailyContentCache = data;
243
+ return data;
244
+ }
245
+ } catch {
246
+ return null;
247
+ }
248
+ return null;
249
+ }
250
+ /**
251
+ * Returns compound words that contain this word.
252
+ */
253
+ static async getCompoundWords(word2) {
254
+ const results = await this.getWord(word2);
255
+ if (results.length === 0)
256
+ return [];
257
+ const compound = [];
258
+ for (const result of results) {
259
+ if (result.birlesikler) {
260
+ const words = result.birlesikler.split(",").map((w) => w.trim());
261
+ compound.push(...words);
262
+ }
263
+ }
264
+ return [...new Set(compound)];
265
+ }
266
+ /**
267
+ * Returns the part of speech (isim, sıfat, zarf vb.).
268
+ */
269
+ static async getPartOfSpeech(word2) {
270
+ const results = await this.getWord(word2);
271
+ const pos = /* @__PURE__ */ new Set();
272
+ for (const result of results) {
273
+ if (result.anlamlarListe) {
274
+ for (const anlam of result.anlamlarListe) {
275
+ if (anlam.ozelliklerListe) {
276
+ for (const ozellik of anlam.ozelliklerListe) {
277
+ pos.add(ozellik.tam_adi);
278
+ }
279
+ }
280
+ }
281
+ }
282
+ }
283
+ if (pos.size === 0 && results.length > 0) {
284
+ pos.add("isim");
285
+ }
286
+ return Array.from(pos);
287
+ }
288
+ /**
289
+ * Fetches multiple words concurrently with a small delay to avoid rate limiting.
290
+ */
291
+ static async getWordsBatch(words) {
292
+ const results = [];
293
+ for (const word2 of words) {
294
+ try {
295
+ const res = await this.getWord(word2);
296
+ results.push(res);
297
+ } catch {
298
+ results.push([]);
299
+ }
300
+ await this.delay(200);
301
+ }
302
+ return results;
303
+ }
304
+ /**
305
+ * Syllabicates a Turkish word based on general grammar rules.
306
+ */
307
+ static syllabicate(word2) {
308
+ const vowels = /[aeıioöuüAEIİOÖUÜ]/;
309
+ const result = [];
310
+ let currentSyllable = "";
311
+ for (let i = word2.length - 1; i >= 0; i--) {
312
+ currentSyllable = word2[i] + currentSyllable;
313
+ if (vowels.test(word2[i])) {
314
+ if (i - 1 >= 0 && !vowels.test(word2[i - 1])) {
315
+ if (i - 2 >= 0 && vowels.test(word2[i - 2])) {
316
+ currentSyllable = word2[i - 1] + currentSyllable;
317
+ i--;
318
+ } else if (i - 2 >= 0 && !vowels.test(word2[i - 2])) {
319
+ currentSyllable = word2[i - 1] + currentSyllable;
320
+ i--;
321
+ }
322
+ }
323
+ result.unshift(currentSyllable);
324
+ currentSyllable = "";
325
+ }
326
+ }
327
+ if (currentSyllable) {
328
+ if (result.length > 0) {
329
+ result[0] = currentSyllable + result[0];
330
+ } else {
331
+ result.push(currentSyllable);
332
+ }
333
+ }
334
+ return result;
335
+ }
336
+ /**
337
+ * Checks if a word follows Turkish Major Vowel Harmony (Büyük Ünlü Uyumu).
338
+ */
339
+ static checkVowelHarmony(word2) {
340
+ const backVowels = /[aıou]/i;
341
+ const frontVowels = /[eiöü]/i;
342
+ const hasBack = backVowels.test(word2);
343
+ const hasFront = frontVowels.test(word2);
344
+ return !(hasBack && hasFront);
345
+ }
346
+ };
347
+
348
+ // src/cli.ts
349
+ var args = process.argv.slice(2);
350
+ var command = args[0];
351
+ var word = args[1];
352
+ async function run() {
353
+ if (!command) {
354
+ console.log("Kullan\u0131m: tdk <komut> <kelime>");
355
+ console.log("Komutlar: ara, anlam, koken, ornek, hece, uyum, yazim");
356
+ process.exit(1);
357
+ }
358
+ TDK.enableCache(false);
359
+ try {
360
+ switch (command) {
361
+ case "ara":
362
+ case "anlam":
363
+ if (!word)
364
+ throw new Error("Kelime belirtmelisiniz.");
365
+ const meanings = await TDK.getMeanings(word);
366
+ if (meanings.length === 0) {
367
+ console.log("Sonu\xE7 bulunamad\u0131.");
368
+ } else {
369
+ meanings.forEach((m, i) => console.log(`${i + 1}. ${m}`));
370
+ }
371
+ break;
372
+ case "koken":
373
+ if (!word)
374
+ throw new Error("Kelime belirtmelisiniz.");
375
+ const origin = await TDK.getOrigin(word);
376
+ console.log(`K\xF6ken: ${origin}`);
377
+ break;
378
+ case "ornek":
379
+ if (!word)
380
+ throw new Error("Kelime belirtmelisiniz.");
381
+ const examples = await TDK.getExamples(word);
382
+ if (examples.length === 0) {
383
+ console.log("\xD6rnek bulunamad\u0131.");
384
+ } else {
385
+ examples.forEach((ex, i) => {
386
+ const yazar = ex.author ? ` (${ex.author})` : "";
387
+ console.log(`${i + 1}. ${ex.sentence}${yazar}`);
388
+ });
389
+ }
390
+ break;
391
+ case "hece":
392
+ if (!word)
393
+ throw new Error("Kelime belirtmelisiniz.");
394
+ const syllables = TDK.syllabicate(word);
395
+ console.log(`Heceler: ${syllables.join("-")}`);
396
+ break;
397
+ case "uyum":
398
+ if (!word)
399
+ throw new Error("Kelime belirtmelisiniz.");
400
+ const isHarmony = TDK.checkVowelHarmony(word);
401
+ console.log(`B\xFCy\xFCk \xDCnl\xFC Uyumu: ${isHarmony ? "Uyar" : "Uymaz"}`);
402
+ break;
403
+ case "yazim":
404
+ if (!word)
405
+ throw new Error("Kelime belirtmelisiniz.");
406
+ const spellResult = await TDK.checkSpelling(word);
407
+ if (spellResult.isCorrect) {
408
+ console.log("Do\u011Fru yaz\u0131m.");
409
+ } else {
410
+ console.log(`Yanl\u0131\u015F yaz\u0131m.${spellResult.suggestion ? " Do\u011Frusu: " + spellResult.suggestion : ""}`);
411
+ }
412
+ break;
413
+ default:
414
+ console.log("Bilinmeyen komut.");
415
+ }
416
+ } catch (error) {
417
+ if (error instanceof Error) {
418
+ console.log(`Hata: ${error.message}`);
419
+ }
420
+ }
421
+ }
422
+ run();
package/dist/cli.mjs ADDED
@@ -0,0 +1,80 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ TDK
4
+ } from "./chunk-MGSXCUAX.mjs";
5
+
6
+ // src/cli.ts
7
+ var args = process.argv.slice(2);
8
+ var command = args[0];
9
+ var word = args[1];
10
+ async function run() {
11
+ if (!command) {
12
+ console.log("Kullan\u0131m: tdk <komut> <kelime>");
13
+ console.log("Komutlar: ara, anlam, koken, ornek, hece, uyum, yazim");
14
+ process.exit(1);
15
+ }
16
+ TDK.enableCache(false);
17
+ try {
18
+ switch (command) {
19
+ case "ara":
20
+ case "anlam":
21
+ if (!word)
22
+ throw new Error("Kelime belirtmelisiniz.");
23
+ const meanings = await TDK.getMeanings(word);
24
+ if (meanings.length === 0) {
25
+ console.log("Sonu\xE7 bulunamad\u0131.");
26
+ } else {
27
+ meanings.forEach((m, i) => console.log(`${i + 1}. ${m}`));
28
+ }
29
+ break;
30
+ case "koken":
31
+ if (!word)
32
+ throw new Error("Kelime belirtmelisiniz.");
33
+ const origin = await TDK.getOrigin(word);
34
+ console.log(`K\xF6ken: ${origin}`);
35
+ break;
36
+ case "ornek":
37
+ if (!word)
38
+ throw new Error("Kelime belirtmelisiniz.");
39
+ const examples = await TDK.getExamples(word);
40
+ if (examples.length === 0) {
41
+ console.log("\xD6rnek bulunamad\u0131.");
42
+ } else {
43
+ examples.forEach((ex, i) => {
44
+ const yazar = ex.author ? ` (${ex.author})` : "";
45
+ console.log(`${i + 1}. ${ex.sentence}${yazar}`);
46
+ });
47
+ }
48
+ break;
49
+ case "hece":
50
+ if (!word)
51
+ throw new Error("Kelime belirtmelisiniz.");
52
+ const syllables = TDK.syllabicate(word);
53
+ console.log(`Heceler: ${syllables.join("-")}`);
54
+ break;
55
+ case "uyum":
56
+ if (!word)
57
+ throw new Error("Kelime belirtmelisiniz.");
58
+ const isHarmony = TDK.checkVowelHarmony(word);
59
+ console.log(`B\xFCy\xFCk \xDCnl\xFC Uyumu: ${isHarmony ? "Uyar" : "Uymaz"}`);
60
+ break;
61
+ case "yazim":
62
+ if (!word)
63
+ throw new Error("Kelime belirtmelisiniz.");
64
+ const spellResult = await TDK.checkSpelling(word);
65
+ if (spellResult.isCorrect) {
66
+ console.log("Do\u011Fru yaz\u0131m.");
67
+ } else {
68
+ console.log(`Yanl\u0131\u015F yaz\u0131m.${spellResult.suggestion ? " Do\u011Frusu: " + spellResult.suggestion : ""}`);
69
+ }
70
+ break;
71
+ default:
72
+ console.log("Bilinmeyen komut.");
73
+ }
74
+ } catch (error) {
75
+ if (error instanceof Error) {
76
+ console.log(`Hata: ${error.message}`);
77
+ }
78
+ }
79
+ }
80
+ run();
@@ -0,0 +1,187 @@
1
+ interface Author {
2
+ yazar_id: string;
3
+ tam_adi: string;
4
+ kisa_adi: string;
5
+ ekno: string;
6
+ }
7
+ interface Example {
8
+ ornek_id: string;
9
+ anlam_id: string;
10
+ ornek_sira: string;
11
+ ornek: string;
12
+ kac: string;
13
+ yazar_id: string;
14
+ yazar_vd: string;
15
+ yazar?: Author[];
16
+ }
17
+ interface Feature {
18
+ ozellik_id: string;
19
+ tur: string;
20
+ tam_adi: string;
21
+ kisa_adi: string;
22
+ ekno: string;
23
+ }
24
+ interface Meaning {
25
+ anlam_id: string;
26
+ madde_id: string;
27
+ anlam_sira: string;
28
+ fiil: string;
29
+ tipkes: string;
30
+ anlam: string;
31
+ anlam_html: string | null;
32
+ gos: string;
33
+ gos_kelime: string;
34
+ gos_kultur: string;
35
+ orneklerListe?: Example[];
36
+ ozelliklerListe?: Feature[];
37
+ }
38
+ interface Proverb {
39
+ madde_id: string;
40
+ madde: string;
41
+ on_taki: string | null;
42
+ }
43
+ interface WordInfo {
44
+ madde_id: string;
45
+ kac: string;
46
+ kelime_no: string;
47
+ cesit: string;
48
+ anlam_gor: string;
49
+ on_taki: string | null;
50
+ on_taki_html: string | null;
51
+ madde: string;
52
+ madde_html: string | null;
53
+ cesit_say: string;
54
+ anlam_say: string;
55
+ taki: string;
56
+ cogul_mu: string;
57
+ ozel_mi: string;
58
+ egik_mi: string;
59
+ lisan_kodu: string;
60
+ lisan: string;
61
+ telaffuz_html: string | null;
62
+ telaffuz: string;
63
+ birlesikler: string | null;
64
+ font: string | null;
65
+ madde_duz: string;
66
+ gosterim_tarihi: string | null;
67
+ anlamlarListe?: Meaning[];
68
+ atasozu?: Proverb[];
69
+ }
70
+ interface DailyContent {
71
+ kelime: {
72
+ madde: string;
73
+ anlam: string;
74
+ }[];
75
+ atasoz: {
76
+ madde: string;
77
+ anlam: string;
78
+ }[];
79
+ kural: {
80
+ adi: string;
81
+ url: string;
82
+ }[];
83
+ syyd: {
84
+ id: string;
85
+ yanliskelime: string;
86
+ dogrukelime: string;
87
+ }[];
88
+ karistirma: {
89
+ id: string;
90
+ yanlis: string;
91
+ dogru: string;
92
+ }[];
93
+ }
94
+ interface SpellCheckResult {
95
+ isCorrect: boolean;
96
+ word: string;
97
+ suggestion?: string;
98
+ }
99
+ type TDKResponse = WordInfo[] | {
100
+ error: string;
101
+ };
102
+
103
+ /**
104
+ * TDK (Türk Dil Kurumu) API Wrapper
105
+ */
106
+ declare class TDK {
107
+ private static readonly BASE_URL;
108
+ private static isCacheEnabled;
109
+ private static wordCache;
110
+ private static dailyContentCache;
111
+ private static autocompleteCache;
112
+ /**
113
+ * Enables or disables in-memory caching for API requests.
114
+ */
115
+ static enableCache(status?: boolean): void;
116
+ /**
117
+ * Clears the internal cache.
118
+ */
119
+ static clearCache(): void;
120
+ private static delay;
121
+ /**
122
+ * Fetches detailed information for a given word from the TDK Dictionary.
123
+ */
124
+ static getWord(word: string): Promise<WordInfo[]>;
125
+ /**
126
+ * Helper method to get only the meanings (definitions) of a word as a string array.
127
+ */
128
+ static getMeanings(word: string): Promise<string[]>;
129
+ /**
130
+ * Returns suggestions (autocomplete) for a given prefix.
131
+ */
132
+ static getSuggestions(prefix: string): Promise<string[]>;
133
+ /**
134
+ * Returns a list of proverbs and idioms containing the word.
135
+ */
136
+ static getProverbs(word: string): Promise<string[]>;
137
+ /**
138
+ * Returns the etymological origin of the word if it's a foreign word.
139
+ */
140
+ static getOrigin(word: string): Promise<string | null>;
141
+ /**
142
+ * Returns literature examples containing the word.
143
+ */
144
+ static getExamples(word: string): Promise<{
145
+ sentence: string;
146
+ author: string | null;
147
+ }[]>;
148
+ /**
149
+ * Returns the direct URL of the audio pronunciation if available.
150
+ * Note: TDK audio URL usually uses the exact audio id. Sometimes it requires MD5, but we provide a common pattern.
151
+ */
152
+ static getAudioUrl(word: string): Promise<string | null>;
153
+ /**
154
+ * Downloads the audio pronunciation to the specified path.
155
+ */
156
+ static downloadAudio(word: string, destPath?: string): Promise<string | null>;
157
+ /**
158
+ * Checks spelling and returns suggestions if wrong.
159
+ */
160
+ static checkSpelling(word: string): Promise<SpellCheckResult>;
161
+ /**
162
+ * Fetches daily content (word of the day, proverbs, rules, etc).
163
+ */
164
+ static getDailyContent(): Promise<DailyContent | null>;
165
+ /**
166
+ * Returns compound words that contain this word.
167
+ */
168
+ static getCompoundWords(word: string): Promise<string[]>;
169
+ /**
170
+ * Returns the part of speech (isim, sıfat, zarf vb.).
171
+ */
172
+ static getPartOfSpeech(word: string): Promise<string[]>;
173
+ /**
174
+ * Fetches multiple words concurrently with a small delay to avoid rate limiting.
175
+ */
176
+ static getWordsBatch(words: string[]): Promise<WordInfo[][]>;
177
+ /**
178
+ * Syllabicates a Turkish word based on general grammar rules.
179
+ */
180
+ static syllabicate(word: string): string[];
181
+ /**
182
+ * Checks if a word follows Turkish Major Vowel Harmony (Büyük Ünlü Uyumu).
183
+ */
184
+ static checkVowelHarmony(word: string): boolean;
185
+ }
186
+
187
+ export { type Author, type DailyContent, type Example, type Feature, type Meaning, type Proverb, type SpellCheckResult, TDK, type TDKResponse, type WordInfo };