ontocast.tool.agg.coreference¶
Coreference candidates for the model to resolve, and what its verdicts do.
Units render in parallel and never see each other's entities, so whether two mentions from different units denote one thing is decided after aggregation. The symbolic tiers settle most pairs; the ones they cannot settle are put to the model, one call per document:
unconfirmed_merge-- merged on a plausible lexical tier only (label overlap, string similarity, an IRI-derived name), never on an equal label, initials, a shared key or a confirmation. Adifferentverdict splits it.near_miss-- similar enough to be a candidate, refused forlexicalalone, with no guard saying the two are distinct. Asameverdict merges.shared_link-- two entities of one type from different units, the only two that point to one node through one predicate (both "applicant in" one case), with no name or embedding evidence: a role phrase and a name for one referent.
A verdict is evidence, not a decision: same merges like a shared key and
different vetoes, and every distinctness guard still applies.
Attributes¶
__all__ = ['CoreferenceCandidate', 'coreference_candidates', 'describe_entity', 'verdict_pairs']
module-attribute
¶
Classes¶
CoreferenceCandidate
¶
Bases: BaseModel
A pair of unit-minted entities whose identity is put to the model.
kind says why: unconfirmed_merge (merged on a plausible lexical
tier only), near_miss (refused for lexical alone) or
shared_link (same type, different units, pointing to one node by one
predicate).
Source code in ontocast/onto/model.py
Functions:¶
coreference_candidates(*, unconfirmed_merges, lexical_near_misses, units, final_uri, max_pairs)
¶
The pairs to put to the model, at most max_pairs.
Only entities units minted are asked about; catalog terms are not, and neither are entities of a citation-metadata unit: authors and venues of a reference list would spend the cap on bibliography. The three kinds take turns, so none crowds the others out: the least similar unconfirmed merges first (the likeliest wrong), the most similar near misses first (the likeliest right), then shared links.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
unconfirmed_merges
|
Sequence[tuple[str, str, float]]
|
|
required |
lexical_near_misses
|
Sequence[tuple[str, str, float]]
|
|
required |
units
|
Sequence[ContentUnit]
|
The aggregated units, their graphs unit-scoped. |
required |
final_uri
|
dict[str, str]
|
Source entity IRI -> its final IRI after aggregation. |
required |
max_pairs
|
int
|
Cap on the pairs returned. |
required |
Source code in ontocast/tool/agg/coreference.py
describe_entity(iri, units)
¶
What the model sees of one entity: names, types, values, links, a sentence.
Read from the graph of the unit that minted it, so each side of a pair is shown as its own unit stated it. The IRI is never shown: a local name is an artefact of minting, two units can mint the same one for unrelated things, and the model would take it as evidence.
Source code in ontocast/tool/agg/coreference.py
verdict_pairs(candidates, verdicts)
¶
(vetoes, confirmations) from verdicts keyed by 1-based pair number.
same confirms a pair, different vetoes it; unsure and pairs
with no verdict change nothing.