pub struct Apposition {
pub primary: String,
pub alias: String,
pub start: usize,
pub end: usize,
pub apposition_type: AppositionType,
pub confidence: f64,
pub primary_is_canonical: bool,
}Expand description
An extracted apposition/alias relationship.
Represents an alias relationship between two surface forms of an entity.
The primary field contains the first-mentioned form, and alias contains
the form introduced by the pattern.
Use canonical() and alternate()
to get the semantically appropriate form regardless of mention order.
Fields§
§primary: StringPrimary entity text (first-mentioned form)
alias: StringAlias/alternate text (introduced by pattern)
start: usizeStart offset of entire span in source text
end: usizeEnd offset of entire span in source text
apposition_type: AppositionTypeType of apposition pattern
confidence: f64Confidence in extraction (0.0-1.0)
primary_is_canonical: boolDirection: true if primary→alias is the name→alias direction
Implementations§
Source§impl Apposition
impl Apposition
Sourcepub fn new(primary: &str, alias: &str, start: usize, end: usize) -> Self
pub fn new(primary: &str, alias: &str, start: usize, end: usize) -> Self
Create a new apposition with default settings.
By default, assumes the primary (first-mentioned) form is canonical.
Sourcepub fn with_type(self, atype: AppositionType) -> Self
pub fn with_type(self, atype: AppositionType) -> Self
Set the apposition type.
Sourcepub fn alias_is_canonical(self) -> Self
pub fn alias_is_canonical(self) -> Self
Mark that the alias is the canonical form.
Use for patterns like “born X” or “better known as X” where the introduced form is the canonical one.
Trait Implementations§
Source§impl Clone for Apposition
impl Clone for Apposition
Source§fn clone(&self) -> Apposition
fn clone(&self) -> Apposition
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Apposition
impl Debug for Apposition
Source§impl<'de> Deserialize<'de> for Apposition
impl<'de> Deserialize<'de> for Apposition
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Apposition
impl RefUnwindSafe for Apposition
impl Send for Apposition
impl Sync for Apposition
impl Unpin for Apposition
impl UnsafeUnpin for Apposition
impl UnwindSafe for Apposition
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,
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