Expand description
Versioned annotation contracts and caller-buffered document views (NLP-100).
v1 ABI (honest): in-process Rust records. Views may contain &'static str
interned lexicon pointers and usize counts (native pointer width). They are
not a C FFI layout. #[repr(C)] is not applied to fat-pointer views.
Cross-language ABI notes belong to NLP-900.
v1 span model: half-open UTF-8 byte crate::nlp::span::DocSpan on the
immutable source. Distinct UTF-16 / code-point / grapheme / model-subtoken
types and reversible alignment maps are NLP-101. Token layering (MWT) is
NLP-103. Nested/discontinuous mention lists are NLP-405.
v1 state: AnalysisState::Complete is the only constructed success
state. Other variants are reserved for later processors; they are not
emitted here. Oversize input on the buffered path is
NlpContractError::SourceTooLarge, not a BudgetExceeded summary.
Hot-path records borrow the immutable source through DocSpan.
Owned strings stay on the cold analyze_document adapter.
Structs§
- Document
Capacities - Slot counts a caller must supply for
analyze_document_intoonsource. - Document
Summary - Filled counts for a successful buffered analysis.
- Document
View Buffers - Caller-owned output slices. Overflow is a typed error; counts are not written as a successful summary when any channel is short.
- HitView
- Gazetteer hit; IRI and surface are interned lexicon pointers (fat pointers).
- Plan
View - Span plan without owned
Stringsurfaces. Interned&'static stris not C ABI. - Sentence
View - Sentence borrowed from the original source. In-process Rust; not a C ABI.
- Token
View - Token borrowed from the original source. In-process Rust; not a C ABI.
Enums§
- Analysis
State - Typed processor outcome. Empty success is
AnalysisState::Completewith zero counts; it is not an error and is not an unavailable processor. - Buffer
Channel - Which caller slice ran out of room.
- NlpContract
Error - Failures for the buffered contract API. Never converted into empty success.
- Norm
View - Date / number view. Values are fixed-width; units are interned.
Constants§
- ANNOTATION_
CONTRACT_ VERSION - Contract schema version for these view records.
- NORM_
INDEX_ NONE - Token with no overlapping normalized value.
- SENTENCE_
ID_ NONE - Token with no containing sentence.
Functions§
- analyze_
document - Cold
Vecadapter. Same year-one pipeline asanalyze_document_into. - analyze_
document_ into - Caller-buffered year-one analysis. Source cap is
crate::nlp::budget::MAX_SOURCE_BYTES. - required_
capacities - Capacities for a successful
analyze_document_intoofsource. - slice_
source - Half-open UTF-8 byte span against
source, orNlpContractError::SpanInvalid.