1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
//! # anno::core
//!
//! Core types for the Anno NLP toolkit: Named Entity Recognition, Coreference
//! Resolution, and Relation Extraction.
//!
//! ## Why This Module Exists
//!
//! NLP pipelines involve many components (tokenizers, NER models, coreference
//! resolvers, entity linkers) that need to share data. Without a common type
//! system, each component defines its own `Entity`, `Span`, `Document` types,
//! requiring tedious conversion code and risking subtle bugs.
//!
//! `anno::core` solves this by providing:
//!
//! 1. **Canonical types** that all components agree on
//! 2. **Rich metadata** beyond basic spans (confidence, provenance, relations)
//! 3. **Grounded hierarchy** for multi-document, multi-modal processing
//! 4. **Coreference** chains and resolver traits
//!
//! ## Core Concepts
//!
//! ### Entities and Spans
//!
//! ```rust,ignore
//! use anno::{Entity, EntityType, Span};
//!
//! let entity = Entity::new("Barack Obama", EntityType::Person)
//! .with_span(Span::new(0, 12))
//! .with_confidence(0.95);
//! ```
//!
//! ### Grounded Documents
//!
//! For cross-document coreference, entities are "grounded" to real-world identities:
//!
//! ```rust,ignore
//! use anno::{GroundedDocument, Identity, Signal};
//!
//! // Multiple mentions across documents resolve to one identity
//! let obama_id = Identity::new("Q76"); // Wikidata ID
//! doc1.ground_mention(mention1, obama_id.clone());
//! doc2.ground_mention(mention2, obama_id);
//! ```
//!
//! ## Module Overview
//!
//! | Module | Purpose |
//! |--------|---------|
//! | `entity` | `Entity`, `Span`, `Relation`, `EntityType` |
//! | `grounded` | `GroundedDocument`, `Identity`, `Signal`, `Track` |
//! | `coref` | `Mention`, `CorefChain`, `CorefDocument` |
//! | `provenance` | Document origin tracking |
//! | `types` | `Gender`, `MentionType`, `TypeLabel` |
//!
//! Graph export lives in `anno::graph` (behind the `graph` feature), not in
//! this `core` module.
//!
//! ## Design Philosophy
//!
//! - **Character offsets, not byte offsets**: Unicode-safe from the start
//! - **Immutable where possible**: Entities are built then used, not mutated
//! - **Serde everywhere**: All types serialize for caching and interop
//! - **No ML dependencies**: Pure data types, no torch/candle/onnx
//!
//! ## Minimal surface
//!
//! If you’re downstream and want a small “just the contract” import set, prefer
//! `crate::minimal` (or `anno::core::*` in the `anno` crate) rather than grabbing the entire
//! re-export surface.
// Re-exports for convenience
pub use Confidence;
pub use ;
pub use ;
pub use ;
// Coreference types
pub use ;
// Other modules accessible via crate::module_name
pub use ;