pub struct RelexEngine { /* private fields */ }Expand description
The relex ONNX inference engine.
Implementations§
Source§impl RelexEngine
impl RelexEngine
Sourcepub fn new(model_path: &Path, tokenizer_path: &Path) -> Result<Self, RelexError>
pub fn new(model_path: &Path, tokenizer_path: &Path) -> Result<Self, RelexError>
Load the relex ONNX model and tokenizer.
Sourcepub fn extract(
&self,
text: &str,
entity_labels: &[&str],
relation_labels: &[&str],
entity_threshold: f32,
relation_threshold: f32,
schema: &ExtractionSchema,
) -> Result<RelexResult, RelexError>
pub fn extract( &self, text: &str, entity_labels: &[&str], relation_labels: &[&str], entity_threshold: f32, relation_threshold: f32, schema: &ExtractionSchema, ) -> Result<RelexResult, RelexError>
Run joint NER + relation extraction on text.
entity_labels: entity type names (e.g., [“Person”, “Database”, “Service”])relation_labels: relation type names (e.g., [“chose”, “replaced”, “depends_on”])entity_threshold: minimum sigmoid score for entity spans (0.0-1.0)relation_threshold: minimum sigmoid score for relations (0.0-1.0)
Auto Trait Implementations§
impl !Freeze for RelexEngine
impl !RefUnwindSafe for RelexEngine
impl Send for RelexEngine
impl Sync for RelexEngine
impl Unpin for RelexEngine
impl UnsafeUnpin for RelexEngine
impl !UnwindSafe for RelexEngine
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