pub struct RuleExtractor { /* private fields */ }Expand description
Extractor implementation that delegates entity detection to the
configured NerProvider and proximity-based relation detection to an
internal verb-window regex.
Construct via RuleExtractor::new or RuleExtractor::with_default_ner.
Implementations§
Source§impl RuleExtractor
impl RuleExtractor
Sourcepub fn new(cfg: ExtractorConfig, ner: Arc<dyn NerProvider>) -> Self
pub fn new(cfg: ExtractorConfig, ner: Arc<dyn NerProvider>) -> Self
Build a new extractor from configuration and a NER provider.
Sourcepub fn with_default_ner(cfg: ExtractorConfig) -> Self
pub fn with_default_ner(cfg: ExtractorConfig) -> Self
Build with the default mnem_ner_providers::RuleNer provider.
Trait Implementations§
Source§impl Debug for RuleExtractor
impl Debug for RuleExtractor
Source§impl Default for RuleExtractor
impl Default for RuleExtractor
Source§impl Extractor for RuleExtractor
impl Extractor for RuleExtractor
Source§fn extract_entities(&self, section: &Section) -> Vec<EntitySpan>
fn extract_entities(&self, section: &Section) -> Vec<EntitySpan>
Extract entity mentions from a single section.
Source§fn extract_relations(
&self,
entities: &[EntitySpan],
section: &Section,
) -> Vec<RelationSpan>
fn extract_relations( &self, entities: &[EntitySpan], section: &Section, ) -> Vec<RelationSpan>
Extract candidate relations between already-extracted entities.
Source§fn prepare(&self, _sections: &[Section]) -> Result<(), Error>
fn prepare(&self, _sections: &[Section]) -> Result<(), Error>
Optional pre-extraction hook. Called once per file by
crate::pipeline::Ingester::ingest BEFORE any
extract_entities / extract_relations call, with the full
list of sections the file produced. The default implementation
is a no-op, so existing extractors keep their behaviour. Read moreAuto Trait Implementations§
impl Freeze for RuleExtractor
impl !RefUnwindSafe for RuleExtractor
impl Send for RuleExtractor
impl Sync for RuleExtractor
impl Unpin for RuleExtractor
impl UnsafeUnpin for RuleExtractor
impl !UnwindSafe for RuleExtractor
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