pub struct EntityExtractor { /* private fields */ }Expand description
Simple entity extraction (rule-based NER) with salience detection
Implementations§
Source§impl EntityExtractor
impl EntityExtractor
pub fn new() -> Self
Sourcepub fn calculate_base_salience(label: &EntityLabel, is_proper_noun: bool) -> f32
pub fn calculate_base_salience(label: &EntityLabel, is_proper_noun: bool) -> f32
Calculate base salience for an entity based on its type and detection confidence
Salience values by entity type:
- Person: 0.8 (highest - people are key context)
- Organization/Product: 0.7
- Location/Technology/Event: 0.6
- Skill: 0.5
- Concept: 0.4
- Date/Other: 0.3
Proper nouns receive a 20% boost (capped at 1.0).
Sourcepub fn extract_with_salience(&self, text: &str) -> Vec<ExtractedEntity>
pub fn extract_with_salience(&self, text: &str) -> Vec<ExtractedEntity>
Extract entities from text with salience information
Sourcepub fn extract_cooccurrence_pairs(&self, text: &str) -> Vec<(String, String)>
pub fn extract_cooccurrence_pairs(&self, text: &str) -> Vec<(String, String)>
Extract co-occurrence pairs from text for graph edge creation
Returns pairs of (entity1, entity2) that appear in the same sentence. This enables creating edges between words that co-occur, which is critical for multi-hop retrieval (e.g., connecting “Melanie” to “sunrise” when they appear in the same sentence about painting).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EntityExtractor
impl RefUnwindSafe for EntityExtractor
impl Send for EntityExtractor
impl Sync for EntityExtractor
impl Unpin for EntityExtractor
impl UnsafeUnpin for EntityExtractor
impl UnwindSafe for EntityExtractor
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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