pub struct NliResult {
pub label: NliLabel,
pub scores: NliScores,
pub available: bool,
}Expand description
Full NLI verdict for a fact pair.
available = false marks graceful-degradation placeholders emitted when the
classifier is unreachable. Downstream code must NOT treat those as “no
contradiction detected” — they mean “not checked”.
Fields§
§label: NliLabel§scores: NliScores§available: boolImplementations§
Source§impl NliResult
impl NliResult
Sourcepub fn exact_match_result() -> NliResult
pub fn exact_match_result() -> NliResult
The canonical NLI result returned for an exact text match.
Identical text is entailment by definition; this bypasses the model and
avoids DeBERTa’s known quirk of returning neutral on identical pairs.
Sourcepub fn is_contradiction(&self, cfg: &NliConfig) -> bool
pub fn is_contradiction(&self, cfg: &NliConfig) -> bool
true iff the contradiction label dominates above the configured threshold.
Sourcepub fn is_entailment(&self, cfg: &NliConfig) -> bool
pub fn is_entailment(&self, cfg: &NliConfig) -> bool
true iff the entailment label dominates above the configured threshold.
Sourcepub fn decide_merge(&self, cfg: &NliConfig) -> MergeReason
pub fn decide_merge(&self, cfg: &NliConfig) -> MergeReason
Classify the NLI verdict into a MergeReason.
available = false→NeutralSkipped(refuse to guess, §5.3).- contradiction →
Drift. - entailment →
Merged. - neutral →
NeutralSkipped.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for NliResult
impl<'de> Deserialize<'de> for NliResult
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<NliResult, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<NliResult, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for NliResult
impl Serialize for NliResult
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,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for NliResult
Auto Trait Implementations§
impl Freeze for NliResult
impl RefUnwindSafe for NliResult
impl Send for NliResult
impl Sync for NliResult
impl Unpin for NliResult
impl UnsafeUnpin for NliResult
impl UnwindSafe for NliResult
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
Mutably borrows from an owned value. Read more