attuned_infer/lib.rs
1//! # attuned-infer
2//!
3//! Fast, transparent inference of human state axes from natural language.
4//!
5//! This crate provides **declared, bounded, and subordinate** inference -
6//! all estimates are auditable, confidence-bounded, and always overridable
7//! by self-report.
8//!
9//! ## Design Principles
10//!
11//! 1. **Declared**: Every inference includes its source and reasoning
12//! 2. **Bounded**: Inferred values have capped confidence (default 0.7)
13//! 3. **Subordinate**: Self-report always overrides inference
14//! 4. **Fast**: Sub-millisecond inference for real-time use
15//!
16//! ## Architecture
17//!
18//! ```text
19//! [Message] ──→ [LinguisticFeatures] ──→ [AxisEstimate]
20//! ~100μs │
21//! ▼
22//! [History] ──→ [DeltaAnalysis] ──────→ [BayesianUpdater] ──→ [StateEstimate]
23//! ~500μs │
24//! ▼
25//! [Self-Report] ─────────────────────→ [Override (σ² → 0)]
26//! ```
27//!
28//! ## Example
29//!
30//! ```rust
31//! use attuned_infer::{InferenceEngine, InferredState};
32//!
33//! let engine = InferenceEngine::default();
34//!
35//! // Infer state from a message
36//! let state = engine.infer("I need help ASAP, this is urgent!!!");
37//!
38//! // All estimates include source and confidence
39//! if let Some(urgency) = state.get("urgency_sensitivity") {
40//! println!("urgency: {:.2} (confidence: {:.2}, source: {:?})",
41//! urgency.value, urgency.confidence, urgency.source);
42//! }
43//! ```
44
45#![deny(missing_docs)]
46#![deny(rustdoc::broken_intra_doc_links)]
47
48mod bayesian;
49mod delta;
50mod engine;
51mod estimate;
52mod features;
53
54pub use bayesian::{BayesianUpdater, Prior};
55pub use delta::{Baseline, DeltaAnalyzer, DeltaSignals};
56pub use engine::{infer, InferenceConfig, InferenceEngine};
57pub use estimate::{
58 max_confidence_for_axis, word_count_confidence_factor, AxisEstimate, InferenceSource,
59 InferredState,
60};
61pub use features::{LinguisticExtractor, LinguisticFeatures};