{"version":3,"sources":["../../src/tr/exceptions.gen.ts","../../src/tr/phonology.ts","../../src/tr/suffixes.ts","../../src/tr/index.ts"],"names":["base","splitPhrase","splitTrailingPunctuation","joinPhrase","registerLanguage"],"mappings":";;;;;AAiBA,IAAM,SAAA,GAAY,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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,SAAS,MAAA,EAAQ;AAE9B,IAAA,OAAO,MAAA,CAAO,UAAU,OAAA,CAAQ,KAAA,CAAM,UAAU,MAAA,CAAO,MAAA,IAAU,OAAA,CAAQ,KAAA,CAAM,MAAA,GAAS,CAAA;AAAA,EAC1F;AACF;AAEAC,kCAAA,CAAiB,EAAE,CAAA","file":"index.cjs","sourcesContent":["/**\n * GENERATED FILE — Turkish stem lexicon. DO NOT EDIT BY HAND.\n *\n * Emitted by data-pipeline/run-turkish.ts from UniMorph tur\n * (https://github.com/unimorph/tur). Data licence: CC BY-SA — see\n * LICENSE-DATA.md.\n *\n * Turkish morphology is phonological almost everywhere, so this file is\n * small by design: it records only which words refuse to voice their final\n * `p ç t k` before a vowel (`top` → `topu`, not *tobu), plus a handful of\n * irregular buffer consonants (`su` → `suyun`).\n *\n *   h — hard: the final consonant does not soften\n *   y — takes a y buffer where n would be expected\n */\nimport type { TrStemFlags } from \"./suffixes.js\";\n\nconst STEM_DATA = `adalet|h\nafiyet|h\nahtapot|h\nakçaağaç|h\nakrobat|h\nalamet|h\nalet|h\nalt|h\nanket|h\nasimptot|h\nastronot|h\naşiret|h\naşk|h\natlambaç|h\navukat|h\naygıt|h\nbaharat|h\nbaht|h\nbank|h\nbaşkent|h\nbazalt|h\nbereket|h\nbiftekkek|h\nbip|h\nbisiklet|h\nbok|h\nbulut|h\nbürokrat|h\nbüst|h\ncennet|h\ncibiliyet|h\nciklet|h\ncinsiyet|h\nçap|h\nçeç|h\nçıt|h\nçift|h\nçip|h\nçöp|h\ndehşet|h\ndeist|h\ndinamit|h\ndisket|h\ndut|h\ndük|h\nebediyet|h\nedat|h\nedebiyat|h\nehemmiyet|h\nek|h\nekonomist|h\nelement|h\nemniyet|h\net|h\netiket|h\neziyet|h\nfagot|h\nferibot|h\nfok|h\ngaflet|h\nglasnost|h\ngöç|h\ngöt|h\nhaç|h\nhafriyat|h\nhalk|h\nhasret|h\nhedonist|h\nheyet|h\nhidrat|h\nhukuk|h\nhükûmet|h\niffet|h\nip|h\niskelet|h\nistirahat|h\nit|h\njilet|h\nkâinat|h\nkanat|h\nkart|h\nkaset|h\nkastanyet|h\nkat|h\nkefalet|h\nkek|h\nkesyap|h\nkıç|h\nkıyafet|h\nkıyamet|h\nkıymet|h\nkibrit|h\nkip|h\nkispet|h\nkist|h\nklarnet|h\nklatrat|h\nkloroplast|h\nkoordinat|h\nkot|h\nkotanjant|h\nkozmonot|h\nkravat|h\nkrep|h\nkuvvet|h\nkülfet|h\nkümbet|h\nkürk|h\nKürt|h\nküvet|h\nlezzet|h\nlolipop|h\nlunapark|h\nmaç|h\nmalt|h\nmalumat|h\nmasumiyet|h\nmazot|h\nmemleket|h\nmesuliyet|h\nmeşrubat|h\nmezuniyet|h\nmisket|h\nmuhalefet|h\nmukavemet|h\nmüracaat|h\nnefret|h\nneşriyat|h\nnet|h\nnihayet|h\nnot|h\nomlet|h\not|h\nözet|h\npandeist|h\npanendeist|h\npanteist|h\npipet|h\nplanet|h\npop|h\nport|h\nprostat|h\nprototip|h\npsikiyatrist|h\nraket|h\nrobot|h\nroket|h\nsaç|h\nsalahiyet|h\nsanat|h\nsandviç|h\nsepet|h\nsevkiyat|h\nsıfat|h\nsik|h\nsirk|h\nstart|h\nşark|h\nşehvet|h\nşikayet|h\nşikâyet|h\nşirket|h\nşok|h\nşort|h\ntabiyet|h\ntabut|h\ntaht|h\ntakat|h\ntanjant|h\ntatbik|h\ntaykonot|h\nteğet|h\nterapist|h\nteşkilat|h\ntip|h\ntop|h\ntuvalet|h\nvasiyet|h\nvaziyet|h\nvefat|h\nvikipedist|h\nvilayet|h\nyakantop|h\nyakut|h\nyanıt|h\nyazıt|h\nyörekent|h\nyüzüncü|y\nzahmet|h\nziggurat|h\nziyaret|h\nzürriyet|h\n`;\n\n/** Words whose final consonant does not soften, and other stem oddities. */\nexport const STEM_FLAGS: ReadonlyMap<string, TrStemFlags> = new Map(\n  STEM_DATA.split(\"\\n\")\n    .filter((line) => line.length > 0)\n    .map((line) => {\n      const [lemma, spec] = line.split(\"|\") as [string, string];\n      const flags: TrStemFlags = {};\n      for (const flag of spec.split(\",\")) {\n        if (flag === \"h\") flags.softens = false;\n        else if (flag === \"y\") flags.bufferY = true;\n      }\n      return [lemma, flags] as const;\n    }),\n);\n","/**\n * Turkish phonology.\n *\n * Turkish is agglutinative like Hungarian, so the same shape of machinery\n * applies — but where Hungarian harmony has two axes, Turkish has two\n * separate harmony systems that pick different suffix vowels, and it also\n * changes the *stem* where a suffix meets it.\n */\n\n/** Back vowels: they select `a` and `ı` class suffixes. */\nconst BACK = new Set([...\"aıou\"]);\n/** Rounded vowels: with backness they select the four-way vowel. */\nconst ROUNDED = new Set([...\"ouöü\"]);\n\nconst VOWELS = \"aeıioöuü\";\n\n/** Consonants that devoice a following `d`: locative `-de` → `-te`. */\nconst VOICELESS = new Set([...\"fstkçşhp\"]);\n\n/** The last vowel of a word, which every suffix harmonizes with. */\nexport function lastVowel(word: string): string | undefined {\n  const lower = word.toLowerCase();\n  for (let i = lower.length - 1; i >= 0; i--) {\n    const ch = lower[i] as string;\n    if (VOWELS.includes(ch)) return ch;\n  }\n  return undefined;\n}\n\nexport function endsInVowel(word: string): boolean {\n  const last = word.at(-1)?.toLowerCase();\n  return last !== undefined && VOWELS.includes(last);\n}\n\n/**\n * Two-way harmony, the `a`/`e` alternation: `-lar` after a back vowel,\n * `-ler` after a front one.\n */\nexport function lowVowel(word: string): \"a\" | \"e\" {\n  const vowel = lastVowel(word);\n  return vowel !== undefined && BACK.has(vowel) ? \"a\" : \"e\";\n}\n\n/**\n * Four-way harmony, the `ı`/`i`/`u`/`ü` alternation: backness and rounding\n * are both copied from the last vowel. `kitabı`, `evi`, `okulu`, `gözü`.\n */\nexport function highVowel(word: string): \"ı\" | \"i\" | \"u\" | \"ü\" {\n  const vowel = lastVowel(word);\n  if (vowel === undefined) return \"i\";\n  const back = BACK.has(vowel);\n  const rounded = ROUNDED.has(vowel);\n  if (back) return rounded ? \"u\" : \"ı\";\n  return rounded ? \"ü\" : \"i\";\n}\n\n/** True when a `d`-initial suffix must be written with `t` instead. */\nexport function devoices(word: string): boolean {\n  const last = word.at(-1)?.toLowerCase();\n  return last !== undefined && VOICELESS.has(last);\n}\n\n/**\n * Final-consonant softening: `p ç t k` voice to `b c d ğ` when a vowel\n * follows — `kitap` → `kitabı`, `ağaç` → `ağacı`, `sokak` → `sokağı`.\n *\n * Whether a word softens at all is lexical, not phonological: `kitap`\n * softens but `top` does not, and nothing in the spelling says which. The\n * generated lexicon carries the exceptions; this function applies the\n * productive rule.\n */\nconst SOFTENING: Record<string, string> = { p: \"b\", ç: \"c\", t: \"d\", k: \"ğ\" };\n\nexport function soften(word: string): string {\n  const last = word.at(-1) as string | undefined;\n  if (last === undefined) return word;\n  // \"nk\" softens to \"ng\" rather than \"nğ\": renk → rengi.\n  if (last.toLowerCase() === \"k\" && word.at(-2)?.toLowerCase() === \"n\") {\n    return `${word.slice(0, -1)}g`;\n  }\n  const soft = SOFTENING[last.toLowerCase()];\n  if (soft === undefined) return word;\n  return word.slice(0, -1) + (last === last.toUpperCase() ? soft.toUpperCase() : soft);\n}\n\n/** True when the word could soften, before the lexicon has its say. */\nexport function canSoften(word: string): boolean {\n  const last = word.at(-1)?.toLowerCase();\n  return last !== undefined && last in SOFTENING;\n}\n","import { canSoften, devoices, endsInVowel, highVowel, lowVowel, soften } from \"./phonology.js\";\n\n/**\n * Turkish case suffixes.\n *\n * Three things happen where a suffix meets a stem: the suffix vowel\n * harmonizes, a `d` devoices to `t` after a voiceless consonant, and a\n * buffer consonant appears to keep two vowels apart — `y` before the\n * accusative and dative, `n` before the genitive.\n */\n\n/** The cases Turkish marks with a suffix. */\nexport type TrCase = \"accusative\" | \"dative\" | \"inessive\" | \"elative\" | \"genitive\" | \"instrumental\";\n\n/** Whether the word softens its final consonant before a vowel. */\nexport interface TrStemFlags {\n  /** `false` overrides the productive rule: `top` → `topu`, not *tobu. */\n  softens?: boolean;\n  /** Irregular buffer, as in `su` → `suyun` where `n` would be expected. */\n  bufferY?: boolean;\n  /**\n   * The word already carries a third-person possessive suffix, as the head\n   * of a compound does: `göbek dansı`, `cep telefonu`. Case suffixes then\n   * need an `-n-` between them and the possessive — `dansına`, not\n   * *dansıya.\n   */\n  possessed?: boolean;\n}\n\n/** The stem a vowel-initial suffix attaches to. */\nfunction vowelStem(word: string, flags: TrStemFlags | undefined): string {\n  if (!canSoften(word)) return word;\n  return flags?.softens === false ? word : soften(word);\n}\n\n/** Build the plural: `-lar` or `-ler`. */\nexport function pluralForm(word: string): string {\n  return `${word}l${lowVowel(word)}r`;\n}\n\n/**\n * Attach a case suffix to a word (which may already be a plural).\n */\nexport function applyCase(word: string, trCase: TrCase, flags?: TrStemFlags): string {\n  const high = highVowel(word);\n  const low = lowVowel(word);\n  const vowelFinal = endsInVowel(word);\n\n  // A possessed head takes an -n- before every case suffix, and then\n  // behaves as if it ended in a consonant.\n  if (flags?.possessed) {\n    switch (trCase) {\n      case \"accusative\":\n        return `${word}n${high}`;\n      case \"dative\":\n        return `${word}n${low}`;\n      case \"genitive\":\n        return `${word}n${high}n`;\n      case \"inessive\":\n        return `${word}nd${low}`;\n      case \"elative\":\n        return `${word}nd${low}n`;\n      case \"instrumental\":\n        return `${word}yl${low}`;\n    }\n  }\n\n  switch (trCase) {\n    case \"accusative\": {\n      // A buffer y keeps the two vowels apart: araba → arabayı.\n      if (vowelFinal) return `${word}y${high}`;\n      return vowelStem(word, flags) + high;\n    }\n    case \"dative\": {\n      if (vowelFinal) return `${word}y${low}`;\n      return vowelStem(word, flags) + low;\n    }\n    case \"genitive\": {\n      if (vowelFinal) return `${word}${flags?.bufferY ? \"y\" : \"n\"}${high}n`;\n      return `${vowelStem(word, flags) + high}n`;\n    }\n    // The locative and ablative start with a consonant, so the stem never\n    // softens — but the consonant itself devoices after p, ç, t, k and the\n    // rest: kitapta, evde.\n    case \"inessive\":\n      return word + (devoices(word) ? \"t\" : \"d\") + low;\n    case \"elative\":\n      return `${word + (devoices(word) ? \"t\" : \"d\") + low}n`;\n    case \"instrumental\":\n      return vowelFinal ? `${word}yl${low}` : `${word}l${low}`;\n  }\n}\n\n/** Inflect a Turkish noun: plural and/or case. */\nexport function inflectNoun(\n  word: string,\n  plural: boolean,\n  trCase: TrCase | undefined,\n  flags?: TrStemFlags,\n): string {\n  if (flags?.possessed) {\n    // The plural sits inside the possessive: göbek dansı → göbek dansları.\n    const base = plural ? `${word.slice(0, -1)}l${lowVowel(word)}r${highVowel(word)}` : word;\n    return trCase ? applyCase(base, trCase, flags) : base;\n  }\n  // The plural suffix is itself vowel-initial, so it triggers softening:\n  // kitap → kitaplar keeps the p (the suffix starts with l), but the case\n  // then harmonizes with the plural's own vowel.\n  const base = plural ? pluralForm(word) : word;\n  if (!trCase) return base;\n  // Only the bare stem can soften; a plural ends in -r.\n  return applyCase(base, trCase, plural ? undefined : flags);\n}\n","import type { GrammaticalCase, GrammaticalFeatures } from \"../core/features.js\";\nimport type { InflectionContext, InflectionResult, LanguagePack } from \"../core/pack.js\";\nimport { joinPhrase, splitPhrase, splitTrailingPunctuation } from \"../core/phrase.js\";\nimport { registerLanguage } from \"../core/registry.js\";\nimport { STEM_FLAGS } from \"./exceptions.gen.js\";\nimport { highVowel, lowVowel } from \"./phonology.js\";\nimport { inflectNoun, type TrCase } from \"./suffixes.js\";\n\n/**\n * Turkish language pack.\n *\n * Turkish marks case with suffixes and has no articles or gender, so almost\n * everything is phonology: two harmony systems choose the suffix vowel, a\n * `d` devoices after voiceless consonants, and the stem's final `p ç t k`\n * voices before a vowel. That last one is the only lexical part — `kitap`\n * softens to `kitabı` but `top` stays `topu` — and it comes from a\n * generated lexicon.\n *\n * `import \"i18n-inflect/tr\"` registers it as a side effect.\n */\n\nconst CASES: Partial<Record<GrammaticalCase, TrCase>> = {\n  accusative: \"accusative\",\n  dative: \"dative\",\n  genitive: \"genitive\",\n  inessive: \"inessive\",\n  superessive: \"inessive\", // Turkish makes no on/in distinction here\n  elative: \"elative\",\n  ablative: \"elative\",\n  instrumental: \"instrumental\",\n  comitative: \"instrumental\",\n};\n\n/** Proper nouns take their suffix after an apostrophe: `İstanbul'a`. */\nconst PROPER = /^[A-ZÇĞİÖŞÜ]/;\n\nfunction inflectPhrase(\n  phrase: string,\n  features: GrammaticalFeatures,\n  ctx: InflectionContext,\n): InflectionResult {\n  const split = splitPhrase(phrase);\n  if (split.words.length === 0) return { text: phrase, confidence: \"high\" };\n\n  let trCase: TrCase | undefined;\n  if (features.case && features.case !== \"nominative\") {\n    trCase = CASES[features.case];\n    if (trCase === undefined) {\n      ctx.warn(\"unknown-feature-value\", `case not supported for tr: ${features.case}`);\n    }\n  }\n  const plural = features.number === \"plural\";\n  if (!plural && trCase === undefined) return { text: phrase, confidence: \"high\" };\n\n  // Turkish inflects the head, which is the last word of the phrase.\n  const headIdx = split.wordIndexes[split.words.length - 1] as number;\n  const [core, punct] = splitTrailingPunctuation(split.parts[headIdx] as string);\n  // A multi-word compound's head carries a third-person possessive\n  // (cep telefonu, otobüs durağı), which changes how case attaches.\n  const looksPossessed = split.words.length > 1 && /[ıiuü]$/.test(core.toLowerCase());\n  const flags =\n    STEM_FLAGS.get(core.toLowerCase()) ?? (looksPossessed ? { possessed: true } : undefined);\n\n  if (PROPER.test(core)) {\n    // The apostrophe separates the name from its suffix, so the suffix is\n    // whatever the rules produce minus the stem.\n    const inflected = inflectNoun(core, plural, trCase, flags);\n    const suffix = inflected.slice(core.length);\n    // Softening does not apply across an apostrophe: Sinop'a, not Sinob'a.\n    const plain = inflectNoun(core, plural, trCase, { softens: false });\n    const plainSuffix = plain.slice(core.length);\n    split.parts[headIdx] = `${core}'${plainSuffix || suffix}${punct}`;\n    return { text: joinPhrase(split), confidence: \"high\" };\n  }\n\n  split.parts[headIdx] = inflectNoun(core, plural, trCase, flags) + punct;\n  return { text: joinPhrase(split), confidence: \"high\" };\n}\n\n/** The Turkish language pack. */\nexport const tr: LanguagePack = {\n  locale: \"tr\",\n  inflectPhrase,\n  acceptFallback(request, answer) {\n    // Suffixation only ever extends the word, allowing one softened letter.\n    return answer.length >= request.lemma.length && answer.length <= request.lemma.length + 8;\n  },\n};\n\nregisterLanguage(tr);\n\nexport { highVowel, lowVowel };\n"]}