pub struct SimpleCorefResolver { /* private fields */ }Expand description
Simple rule-based coreference resolver.
Applies the nine-sieve pipeline described in the module documentation to assign
CanonicalIds to a sequence of Entity values. Entities that corefer receive the
same id; singletons receive a unique id.
§Example
use anno::Entity;
use anno::EntityType;
use anno::backends::coref::simple::{SimpleCorefResolver, CorefConfig};
let resolver = SimpleCorefResolver::new(CorefConfig::default());
let entities = vec![
Entity::new("John Smith", EntityType::Person, 0, 10, 0.9),
Entity::new("he", EntityType::Person, 15, 17, 0.8),
Entity::new("John Smith", EntityType::Person, 30, 40, 0.9),
];
let resolved = resolver.resolve(&entities);
// All three mentions share the same canonical_id.
assert_eq!(resolved[0].canonical_id, resolved[1].canonical_id);
assert_eq!(resolved[0].canonical_id, resolved[2].canonical_id);Implementations§
Source§impl SimpleCorefResolver
impl SimpleCorefResolver
Sourcepub fn new(config: CorefConfig) -> SimpleCorefResolver
pub fn new(config: CorefConfig) -> SimpleCorefResolver
Create a new resolver with configuration.
Sourcepub fn resolve_entities(&self, entities: &[Entity]) -> Vec<Entity>
pub fn resolve_entities(&self, entities: &[Entity]) -> Vec<Entity>
Resolve coreference for entities, assigning canonical IDs.
Sourcepub fn resolve(&self, entities: &[Entity]) -> Vec<Entity>
pub fn resolve(&self, entities: &[Entity]) -> Vec<Entity>
Resolve coreference for entities.
This is an inherent-method convenience wrapper so callers do not need to import the
CoreferenceResolver trait to call resolver.resolve(&entities).
Sourcepub fn resolve_to_chains(&self, entities: &[Entity]) -> Vec<CorefChain>
pub fn resolve_to_chains(&self, entities: &[Entity]) -> Vec<CorefChain>
Convert resolved entities directly to coreference chains.
Requires the analysis feature.
Trait Implementations§
Source§impl Clone for SimpleCorefResolver
impl Clone for SimpleCorefResolver
Source§fn clone(&self) -> SimpleCorefResolver
fn clone(&self) -> SimpleCorefResolver
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl CoreferenceResolver for SimpleCorefResolver
impl CoreferenceResolver for SimpleCorefResolver
Source§impl Debug for SimpleCorefResolver
impl Debug for SimpleCorefResolver
Source§impl Default for SimpleCorefResolver
impl Default for SimpleCorefResolver
Source§fn default() -> SimpleCorefResolver
fn default() -> SimpleCorefResolver
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SimpleCorefResolver
impl RefUnwindSafe for SimpleCorefResolver
impl Send for SimpleCorefResolver
impl Sync for SimpleCorefResolver
impl Unpin for SimpleCorefResolver
impl UnsafeUnpin for SimpleCorefResolver
impl UnwindSafe for SimpleCorefResolver
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,
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>
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