pub enum RelEngine {
ModelBased(ModelBasedRelEngine),
Heuristic,
}Expand description
Relation extraction engine — fully local, no external API calls.
Extraction tiers:
- Model-based: GLiNER multitask ONNX model for typed relation extraction.
- Heuristic: Pattern-based keyword + proximity extraction (~0.51 F1).
Experimental (opt-in via CTXGRAPH_RELEX=1):
- Relex: gliner-relex ONNX model (joint NER + relation extraction).
Variants§
Implementations§
Source§impl RelEngine
impl RelEngine
Sourcepub fn new(
model_path: Option<&Path>,
tokenizer_path: Option<&Path>,
) -> Result<Self, RelError>
pub fn new( model_path: Option<&Path>, tokenizer_path: Option<&Path>, ) -> Result<Self, RelError>
Create a model-based engine if the multitask model is available, otherwise fall back to heuristic mode.
Sourcepub fn extract(
&self,
text: &str,
entities: &[ExtractedEntity],
schema: &ExtractionSchema,
) -> Result<Vec<ExtractedRelation>, RelError>
pub fn extract( &self, text: &str, entities: &[ExtractedEntity], schema: &ExtractionSchema, ) -> Result<Vec<ExtractedRelation>, RelError>
Extract relations between entities — fully local, no API calls.
Uses heuristic keyword + proximity extraction (~0.51 F1).
Environment variables:
CTXGRAPH_RELEX=1: Enable experimental relex ONNX tier
Auto Trait Implementations§
impl Freeze for RelEngine
impl !RefUnwindSafe for RelEngine
impl Send for RelEngine
impl Sync for RelEngine
impl Unpin for RelEngine
impl UnsafeUnpin for RelEngine
impl !UnwindSafe for RelEngine
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