pub struct ConfusableSet {
pub surface_form: String,
pub entities: Vec<ConfusableEntity>,
}Expand description
A set of confusable entities for a given surface form.
Fields§
§surface_form: StringThe surface form (e.g., “John Smith”)
entities: Vec<ConfusableEntity>All confusable entities
Implementations§
Source§impl ConfusableSet
impl ConfusableSet
Sourcepub fn new(surface_form: &str) -> ConfusableSet
pub fn new(surface_form: &str) -> ConfusableSet
Create a new confusable set.
Sourcepub fn add(
&mut self,
kb_id: &str,
reason: ConfusableReason,
description: Option<&str>,
)
pub fn add( &mut self, kb_id: &str, reason: ConfusableReason, description: Option<&str>, )
Add a confusable entity.
Sourcepub fn add_entity(&mut self, entity: ConfusableEntity)
pub fn add_entity(&mut self, entity: ConfusableEntity)
Add a full confusable entity.
Sourcepub fn to_training_pairs(&self, positive_kb_id: &str) -> Vec<TrainingPair>
pub fn to_training_pairs(&self, positive_kb_id: &str) -> Vec<TrainingPair>
Generate training pairs for contrastive learning.
Given a positive entity ID, returns (positive, negative) pairs for all other confusable entities.
Sourcepub fn filter_by_reason(
&self,
reason: &ConfusableReason,
) -> Vec<&ConfusableEntity>
pub fn filter_by_reason( &self, reason: &ConfusableReason, ) -> Vec<&ConfusableEntity>
Get entities by reason.
Trait Implementations§
Source§impl Clone for ConfusableSet
impl Clone for ConfusableSet
Source§fn clone(&self) -> ConfusableSet
fn clone(&self) -> ConfusableSet
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ConfusableSet
impl Debug for ConfusableSet
Source§impl Default for ConfusableSet
impl Default for ConfusableSet
Source§fn default() -> ConfusableSet
fn default() -> ConfusableSet
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ConfusableSet
impl<'de> Deserialize<'de> for ConfusableSet
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ConfusableSet, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ConfusableSet, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for ConfusableSet
impl Serialize for ConfusableSet
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for ConfusableSet
impl RefUnwindSafe for ConfusableSet
impl Send for ConfusableSet
impl Sync for ConfusableSet
impl Unpin for ConfusableSet
impl UnsafeUnpin for ConfusableSet
impl UnwindSafe for ConfusableSet
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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