pub struct Provenance {
pub source: Cow<'static, str>,
pub method: ExtractionMethod,
pub pattern: Option<Cow<'static, str>>,
pub raw_confidence: Option<f64>,
pub model_version: Option<Cow<'static, str>>,
pub timestamp: Option<String>,
}Expand description
Provenance information for an extracted entity.
Tracks where an entity came from for debugging, explainability, and confidence calibration in hybrid/ensemble systems.
Fields§
§source: Cow<'static, str>Name of the backend that produced this entity (e.g., “pattern”, “bert-onnx”)
method: ExtractionMethodExtraction method used
pattern: Option<Cow<'static, str>>Specific pattern/rule name (for pattern/rule-based extraction)
raw_confidence: Option<f64>Raw confidence from the source model (before any calibration)
model_version: Option<Cow<'static, str>>Model version for reproducibility (e.g., “gliner-v2.1”, “bert-base-uncased-2024-01”)
timestamp: Option<String>Timestamp when extraction occurred (ISO 8601)
Implementations§
Source§impl Provenance
impl Provenance
Sourcepub fn pattern(pattern_name: &'static str) -> Self
pub fn pattern(pattern_name: &'static str) -> Self
Create provenance for regex-based extraction.
Sourcepub fn ml(model_name: impl Into<Cow<'static, str>>, confidence: f64) -> Self
pub fn ml(model_name: impl Into<Cow<'static, str>>, confidence: f64) -> Self
Create provenance for ML-based extraction.
Accepts both static strings and owned strings:
// Static string (zero allocation)
Provenance::ml("gliner", 0.95);
// Owned string (dynamic model name)
Provenance::ml(model_name.to_string(), 0.95);Sourcepub fn ml_owned(model_name: impl Into<String>, confidence: f64) -> Self
👎Deprecated since 0.2.1: Use ml() instead, it now accepts owned strings
pub fn ml_owned(model_name: impl Into<String>, confidence: f64) -> Self
Deprecated: Use ml() instead which now accepts both static and owned strings.
Sourcepub fn ensemble(sources: &'static str) -> Self
pub fn ensemble(sources: &'static str) -> Self
Create provenance for ensemble/hybrid extraction.
Sourcepub fn with_version(self, version: &'static str) -> Self
pub fn with_version(self, version: &'static str) -> Self
Create provenance with model version for reproducibility.
Sourcepub fn with_timestamp(self, timestamp: impl Into<String>) -> Self
pub fn with_timestamp(self, timestamp: impl Into<String>) -> Self
Create provenance with timestamp.
Trait Implementations§
Source§impl Clone for Provenance
impl Clone for Provenance
Source§fn clone(&self) -> Provenance
fn clone(&self) -> Provenance
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more