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) -> Provenance
pub fn pattern(pattern_name: &'static str) -> Provenance
Create provenance for regex-based extraction.
Sourcepub fn ml(
model_name: impl Into<Cow<'static, str>>,
confidence: f64,
) -> Provenance
pub fn ml( model_name: impl Into<Cow<'static, str>>, confidence: f64, ) -> Provenance
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) -> Provenance
👎Deprecated since 0.2.1: Use ml() instead, it now accepts owned strings
pub fn ml_owned(model_name: impl Into<String>, confidence: f64) -> Provenance
Deprecated: Use ml() instead which now accepts both static and owned strings.
Sourcepub fn ensemble(sources: &'static str) -> Provenance
pub fn ensemble(sources: &'static str) -> Provenance
Create provenance for ensemble/hybrid extraction.
Sourcepub fn with_version(self, version: &'static str) -> Provenance
pub fn with_version(self, version: &'static str) -> Provenance
Create provenance with model version for reproducibility.
Sourcepub fn with_timestamp(self, timestamp: impl Into<String>) -> Provenance
pub fn with_timestamp(self, timestamp: impl Into<String>) -> Provenance
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 moreSource§impl Debug for Provenance
impl Debug for Provenance
Source§impl Default for Provenance
impl Default for Provenance
Source§fn default() -> Provenance
fn default() -> Provenance
Source§impl<'de> Deserialize<'de> for Provenance
impl<'de> Deserialize<'de> for Provenance
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Provenance, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Provenance, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for Provenance
impl PartialEq for Provenance
Source§impl Serialize for Provenance
impl Serialize for Provenance
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for Provenance
Auto Trait Implementations§
impl Freeze for Provenance
impl RefUnwindSafe for Provenance
impl Send for Provenance
impl Sync for Provenance
impl Unpin for Provenance
impl UnsafeUnpin for Provenance
impl UnwindSafe for Provenance
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more