Resolve copula predicate to subject's licensed type (issue #128 R12)#130
Conversation
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: #128
Promote the predicate noun in an 'X is a Y' copula to the subject's asserted instance-of / subclass-of type at formalization time, language- neutrally. 'Hawaii is a state.' now resolves 'state' to Q35657 (U.S. state, ru: Штат США) instead of the generic federated-state concept Q7275, so no per-language translation rule is needed. - Add js/src/copula-types.js (resolveCopulaTypes pass, dependency-injected) - Add js/src/wikidata-entity-context.js shared by formalize.js and the new pass; keeps formalize.js within the 1500-line budget - Remove the bespoke english-us-state-predicate-to-russian-shtat rule from translate.js; targetLabelFor prefers the interlingua concept form - Flip 'state'/'штат' to Q35657 in the Rust core, its curated reference, and the committed WASM build for JS<->Rust parity - Update issue-128/issue-35 case studies, docs/REQUIREMENTS.md, the affected JS/Rust tests, add an offline example and a changeset
Working session summaryEverything is complete and green. Final summary: Done — Issue #128 R12 fully addressed in PR #130The deep fix: "Hawaii is a state." now resolves the predicate "state" to its most-correct contextual sense — How it works: a new formalization pass promotes the copula predicate to the subject's asserted type (Hawaii Architecture changes:
Verification (all green):
Docs: PR #130 is updated, marked ready for review (no longer draft), working tree clean: #130 This summary was automatically extracted from the AI working session output. |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost: $24.015280📊 Context and tokens usage:Claude Opus 4.8: (6 sub-sessions)
Total: (45.2K new + 617.9K cache writes + 27.1M cache reads) input tokens, 242.7K output tokens, $23.729123 cost Claude Haiku 4.5:
Total: (2.8K new + 93.7K cache writes + 1.3M cache reads) input tokens, 7.6K output tokens, $0.286157 cost 🤖 Models used:
📎 Log file uploaded as Gist (11626KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
Issue #128 R12 — resolve "Hawaii is a state." to the most-correct sense
This follow-up to PR #129 (which delivered R1–R11) addresses the deeper
requirement raised in review: the predicate "state" in "Hawaii is a state."
must resolve to the most correct sense in context —
Q35657U.S. state(Russian: Штат США) — not the
generic federated-state concept
Q7275.Root cause
A bare noun like "state" cannot be disambiguated on its own. But in a copula
sentence the subject already carries an asserted type: Hawaii
instance of(P31)
Q35657"U.S. state". The formalizer never used that licensed type toconstrain the predicate, so "state" stayed generic and the translation leaned
on a hardcoded English→Russian rule.
Fix — language-neutral copula type resolution at formalization time
A new pass promotes the copula predicate to the subject's asserted
instance-of / subclass-of type when their head words agree:
Hawaii is a state.→ "state" resolves toQ35657→en.wikipedia.org/wiki/U.S._stateГавайи это штат.resolves identically via the same logic — no per-language ruleThe bespoke
english-us-state-predicate-to-russian-shtattranslation rule isremoved;
targetLabelFornow prefers the interlingua concept form. The Rustcore, its curated reference, and the committed WASM build are flipped to
Q35657for JS↔Rust parity (rule_count3→2;Q7275retained as a documentedgeneric reference).
How to reproduce / verify
Output (fully offline):
Architecture
js/src/copula-types.js—resolveCopulaTypespass (dependency-injected to avoid a circular import).js/src/wikidata-entity-context.js— shared Wikidata-entity helpers used by bothformalize.jsand the new pass; also keepsformalize.jswithin the 1500-line budget.Tests
examples/copula-type-resolution.jsexercises the full path.issue35_translation,semantic_relations) assert theQ35657outcome.npm run check(lint, format, duplication, docs, parity, cache) all pass.Docs
docs/REQUIREMENTS.mdand the issue-128 / issue-35 case studies updated (R12, RC7, solution plan, timeline, README)..changeset/issue-128-copula-type-resolution.md(meta-expression: minor).Closes #128.