pub struct EventExtractor { /* private fields */ }Expand description
Event extractor with optional neural backend.
Rule-based (default): Uses ACE 2005 trigger lexicon for fast extraction.
Neural (with candle feature): Uses GLiNER bi-encoder for zero-shot extraction.
The neural backend is preferred when available as it generalizes better to unseen event types and handles ambiguity.
Implementations§
Source§impl EventExtractor
impl EventExtractor
Sourcepub fn new() -> EventExtractor
pub fn new() -> EventExtractor
Create a new event extractor with default lexicon (rule-based only).
Sourcepub fn with_config(
config: EventExtractorConfig,
) -> Result<EventExtractor, Error>
pub fn with_config( config: EventExtractorConfig, ) -> Result<EventExtractor, Error>
Create with custom configuration.
If config.gliner_model is set and candle feature is enabled,
will attempt to load the GLiNER model for neural extraction.
Sourcepub fn with_gliner(model_id: &str) -> Result<EventExtractor, Error>
pub fn with_gliner(model_id: &str) -> Result<EventExtractor, Error>
Create with GLiNER model for neural extraction.
Sourcepub fn has_neural_backend(&self) -> bool
pub fn has_neural_backend(&self) -> bool
Check if neural extraction is available.
Sourcepub fn extract(&self, text: &str) -> Vec<EventMention>
pub fn extract(&self, text: &str) -> Vec<EventMention>
Extract events from text.
Uses GLiNER (neural) if available, otherwise falls back to rule-based extraction.
Sourcepub fn extract_referents(&self, text: &str) -> Vec<DiscourseReferent>
pub fn extract_referents(&self, text: &str) -> Vec<DiscourseReferent>
Extract events and convert to discourse referents.
Sourcepub fn extract_with_entities(
&self,
text: &str,
entities: &[Entity],
) -> Vec<EventMention>
pub fn extract_with_entities( &self, text: &str, entities: &[Entity], ) -> Vec<EventMention>
Extract events with entity context (for argument filling).
When entities are provided, they OVERRIDE heuristic argument extraction since NER entities are more reliable than capitalization heuristics.
Sourcepub fn lexicon(&self) -> &EventTriggerLexicon
pub fn lexicon(&self) -> &EventTriggerLexicon
Get the lexicon for inspection or modification.
Trait Implementations§
Source§impl Clone for EventExtractor
impl Clone for EventExtractor
Source§fn clone(&self) -> EventExtractor
fn clone(&self) -> EventExtractor
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EventExtractor
impl Debug for EventExtractor
Source§impl Default for EventExtractor
impl Default for EventExtractor
Source§fn default() -> EventExtractor
fn default() -> EventExtractor
Auto Trait Implementations§
impl !Freeze for EventExtractor
impl !RefUnwindSafe for EventExtractor
impl !UnwindSafe for EventExtractor
impl Send for EventExtractor
impl Sync for EventExtractor
impl Unpin for EventExtractor
impl UnsafeUnpin for EventExtractor
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
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>
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>
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