Skip to content

A kind word binds to a class - #741

Merged
WaylandYang merged 2 commits into
devfrom
feat/a-kind-word-binds-to-a-class
Sep 17, 2026
Merged

WaylandYang merged 2 commits into
devfrom
feat/a-kind-word-binds-to-a-class

Conversation

@WaylandYang

Copy link
Copy Markdown
Contributor

Stacked on #740. The first slice of alignment (0044 decisions 3 and 4): a kind word binds to a class, once per base, and every entity of that kind gets the class. Extraction keeps writing only the document's kind word; classes stay the ontology's; the binding is the view between them.

What lands

Ledger (migration 0065): type_bindings (base, normalised kind word, spellings seen, class or none, status bound | none | undecided, the two votes, decided_at, decided_by agent | person, unique per base and word); entity_types.updated_at so a binding can be told stale; type_source = 'aligned'. Store: signatures (each kind word with count, spellings, example names and the relation phrases its things take part in), stale (bound to a class edited since, or none/undecided decided before a newer class), decide (a person's decision is never overwritten by the agent), apply / unapply (only rows a person has not typed), bound_map, propose (a kind word with no class is offered through the existing proposed-type flow).

Contract (utopia_extract::align): one call over a batch of kind words with candidate classes and definitions; choose a class only when every thing of this kind is an instance of it by its definition, else null.

Job align_types (per base; enqueued after each document's extraction and after a class is created or edited; one run per base at a time under an advisory lock): candidates by ontology embedding when the base has one, else the whole class list when it is small; two votes per word with the candidate order reversed on the second; agreement binds or records none, disagreement records undecided for the alignment queue (#725). Bound classes are written to the entities; run_open passes a bound class into identity resolution so namesakes of different kinds separate again.

Nothing is dropped for a word with no class: the entity keeps its kind word and its statements in the open graph; the only extra is a passive "add a class" suggestion on the ontology page.

Measured on the 25-document batch (14 hand-seeded classes, no embedding model)

180 kind words: 81 bound, 94 none, 5 undecided (two votes disagreed: builders, business, business segment, department, people). 338 of 802 live entities typed (42%); the untyped ones are mostly described things whose word names no kind ("capacity", "changes", "impact"). Bindings read well across domains: company / agency / government → organization; act / reports / application → document; asset / debt / line item / cash flow → financial_metric; disease / condition / side effect → medical_condition; study / trials → clinical_trial; 指标 → statistic; 汽车 / 工业产品 → product; patients / director nominee → person. One doubtful: warning → document.

The first run, triggered fourteen times by fourteen class creations, ran fourteen jobs in parallel and hit the model endpoint with 502s; the lock fixes that, and the serialised run completed with no failures.

Not in this change

Splitting long descriptions into a short head plus the statements folded into them; binding relation phrases to properties and materialising typed facts (the next slices of cut 2); the alignment review queue cards (#725).

🤖 Generated with Claude Code

@WaylandYang
WaylandYang force-pushed the feat/a-time-mention-is-resolved-against-its-document branch from caa8ae2 to db2682c Compare September 17, 2026 13:54
Base automatically changed from feat/a-time-mention-is-resolved-against-its-document to dev September 17, 2026 14:02
WaylandYang and others added 2 commits September 17, 2026 22:02
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: WaylandYang <wayland0916@gmail.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: WaylandYang <wayland0916@gmail.com>
@WaylandYang
WaylandYang force-pushed the feat/a-kind-word-binds-to-a-class branch from 7975cf3 to 7733b07 Compare September 17, 2026 14:02
@WaylandYang
WaylandYang merged commit fa6d4e9 into dev Sep 17, 2026
4 checks passed
@WaylandYang
WaylandYang deleted the feat/a-kind-word-binds-to-a-class branch September 17, 2026 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant