pub struct NliEngine { /* private fields */ }Expand description
NLI-based relation extraction engine.
Implementations§
Source§impl NliEngine
impl NliEngine
Sourcepub fn new(model_path: &Path, tokenizer_path: &Path) -> Result<Self, NliError>
pub fn new(model_path: &Path, tokenizer_path: &Path) -> Result<Self, NliError>
Load the NLI ONNX model and tokenizer.
Sourcepub fn extract(
&self,
text: &str,
entities: &[ExtractedEntity],
schema: &ExtractionSchema,
threshold: f32,
) -> Result<Vec<ExtractedRelation>, NliError>
pub fn extract( &self, text: &str, entities: &[ExtractedEntity], schema: &ExtractionSchema, threshold: f32, ) -> Result<Vec<ExtractedRelation>, NliError>
Extract relations using NLI entailment scoring.
For each entity pair in the text, tests hypothesis templates for each relation type. Returns relations where entailment score exceeds the threshold.
Auto Trait Implementations§
impl !Freeze for NliEngine
impl !RefUnwindSafe for NliEngine
impl Send for NliEngine
impl Sync for NliEngine
impl Unpin for NliEngine
impl UnsafeUnpin for NliEngine
impl !UnwindSafe for NliEngine
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
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>
Converts
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>
Converts
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