pub struct EntityLinker {
pub nil_threshold: f64,
/* private fields */
}Expand description
Links entity mentions in text to knowledge-base entities.
Fields§
§nil_threshold: f64Minimum confidence threshold below which an entity is treated as NIL.
Implementations§
Source§impl EntityLinker
impl EntityLinker
Sourcepub fn add_entity(
&mut self,
iri: impl Into<String>,
label: impl Into<String>,
aliases: &[&str],
)
pub fn add_entity( &mut self, iri: impl Into<String>, label: impl Into<String>, aliases: &[&str], )
Add an entity to the knowledge base.
context is an optional textual description used for TF-IDF
disambiguation.
Sourcepub fn build_index(&mut self)
pub fn build_index(&mut self)
Finalise the TF-IDF index (call after all entities are added).
Sourcepub fn link(&self, text: &str) -> Vec<LinkedEntity>
pub fn link(&self, text: &str) -> Vec<LinkedEntity>
Find and link all entity mentions in text.
Sourcepub fn candidate_generation(&self, mention: &str) -> Vec<EntityCandidate>
pub fn candidate_generation(&self, mention: &str) -> Vec<EntityCandidate>
Generate entity candidates matching the mention by string similarity.
Sourcepub fn disambiguate(
&self,
_mention: &EntityMention,
candidates: &[EntityCandidate],
context: &str,
) -> Option<EntityCandidate>
pub fn disambiguate( &self, _mention: &EntityMention, candidates: &[EntityCandidate], context: &str, ) -> Option<EntityCandidate>
Disambiguate among candidates using context TF-IDF similarity.
Sourcepub fn entity_count(&self) -> usize
pub fn entity_count(&self) -> usize
Number of entities in the knowledge base.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EntityLinker
impl RefUnwindSafe for EntityLinker
impl Send for EntityLinker
impl Sync for EntityLinker
impl Unpin for EntityLinker
impl UnsafeUnpin for EntityLinker
impl UnwindSafe for EntityLinker
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