Skip to main content

Module coref

Module coref 

Source
Expand description

Bounded coreference: exact-string grouping plus an experimental pronoun sieve.

NLP-001 is a resource/contract repair, not a coreference-quality claim. Exact surface grouping is not identity. The name-to-gender list is experimental and must not emit personal gender or identity facts. Substrate mention generation is still one-word-per-mention; NLP-500/NLP-501 replace the detector and heuristic. Empty mention lists skip detection.

Structs§

CancellationToken
Cooperative cancellation. Polls are cheap; a zero cancel_after_polls disables auto-cancel (the production default).
CorefChain
A resolved coreference chain: all mentions judged co-referent.
CorefChainHead
Chain header written into a caller buffer.
CorefLimits
Caller-visible limits. Lower them in tests; raising defaults needs measured resource evidence recorded in the NLP plan.
CorefMention
One coreference mention with byte-span provenance. Cold/host form.
CorefScratch
Caller-owned hot-path workspace.
CorefWorkStats
Instrumented work. These are counters, not wall-clock claims.
MentionWork
Per-mention scratch record. Caller-owned; zero-initialized then filled.
ValidatedMention
Validated mention used on the hot path. Text is the source slice.

Enums§

CorefError
Recoverable coreference failure. Host adapters map budget/cancel/output variants to E400 and the rest to E100.
MentionKind
Coarse mention kind, used by the pronoun sieve for agreement.

Constants§

DEFAULT_MAX_ANTECEDENTS_PER_PRONOUN
Proper-noun candidates inspected per pronoun (search window).
DEFAULT_MAX_ANTECEDENT_CHECKS
Total Proper-noun antecedent inspections per call (non-Proper mentions are skipped without charging this counter).
DEFAULT_MAX_CHAINS
Default emitted-chain cap.
DEFAULT_MAX_MENTIONS
Default mention-list cap.
DEFAULT_MAX_MENTION_TEXT_BYTES
Default aggregate supplied mention-text cap.
DEFAULT_MAX_SOURCE_BYTES
Default source cap (transport-sized, not a latency claim).
DEFAULT_MAX_WORKSPACE_BYTES
Default caller workspace for this operation.
SENTINEL_BYTES
42 MiB Sentinel ceiling. This operation’s workspace must stay under it together with the borrowed source.

Functions§

aggregate_mention_text_bytes
Sum mention-text bytes with saturating arithmetic, failing at the cap.
fnv1a64
FNV-1a 64-bit over already-normalized key bytes.
mention_kind_from_label
Parse a supported mention kind. Unknown strings fail; they are not coerced.
offset_from_i64
Checked conversion from a host i64 offset. Negative values never wrap.
offset_from_u64
Checked conversion from a host u64 offset.
preflight_counts
Reject oversize source/list/text before any grouping work.
resolve_coreferences
Cold adapter: validate, allocate scratch, resolve, materialize chains.
resolve_coreferences_counted
Cold adapter that also returns work counters.
resolve_coreferences_into
Resolves coreferences into out.
validate_mention
Validate one mention against the immutable source. prev enforces document order.
validate_mentions
Validate every mention after the count/byte preflight has passed.
workspace_bytes_required
Bytes for n mention work records plus two u32 permutations plus norm. Cold adapters also allocate validated/heads/ids; those are not part of this hot workspace figure and stay well under the 42 MiB Sentinel.