pub struct EntityBuilder { /* private fields */ }Expand description
Implementations§
Source§impl EntityBuilder
impl EntityBuilder
Sourcepub fn new(text: impl Into<String>, entity_type: EntityType) -> Self
pub fn new(text: impl Into<String>, entity_type: EntityType) -> Self
Create a new builder.
Sourcepub fn confidence(self, confidence: f64) -> Self
pub fn confidence(self, confidence: f64) -> Self
Set confidence score.
Sourcepub fn hierarchical_confidence(self, confidence: HierarchicalConfidence) -> Self
pub fn hierarchical_confidence(self, confidence: HierarchicalConfidence) -> Self
Set hierarchical confidence.
Sourcepub fn normalized(self, normalized: impl Into<String>) -> Self
pub fn normalized(self, normalized: impl Into<String>) -> Self
Set normalized form.
Sourcepub fn provenance(self, provenance: Provenance) -> Self
pub fn provenance(self, provenance: Provenance) -> Self
Set provenance.
Sourcepub const fn canonical_id(self, canonical_id: u64) -> Self
pub const fn canonical_id(self, canonical_id: u64) -> Self
Set canonical (coreference) ID.
Sourcepub fn visual_span(self, span: Span) -> Self
pub fn visual_span(self, span: Span) -> Self
Set visual span.
Sourcepub fn discontinuous_span(self, span: DiscontinuousSpan) -> Self
pub fn discontinuous_span(self, span: DiscontinuousSpan) -> Self
Set discontinuous span for non-contiguous entities.
This automatically updates start and end to the bounding range.
Sourcepub fn valid_from(self, dt: DateTime<Utc>) -> Self
pub fn valid_from(self, dt: DateTime<Utc>) -> Self
Set temporal validity start (when this entity assertion became true).
§Example
ⓘ
use anno_core::{EntityBuilder, EntityType};
use chrono::{TimeZone, Utc};
let entity = EntityBuilder::new("CEO of Microsoft", EntityType::Person)
.span(0, 12)
.valid_from(Utc.with_ymd_and_hms(2008, 10, 1, 0, 0, 0).unwrap())
.build();
assert!(entity.valid_from.is_some());Sourcepub fn valid_until(self, dt: DateTime<Utc>) -> Self
pub fn valid_until(self, dt: DateTime<Utc>) -> Self
Set temporal validity end (when this entity assertion stopped being true).
Sourcepub fn temporal_range(self, from: DateTime<Utc>, until: DateTime<Utc>) -> Self
pub fn temporal_range(self, from: DateTime<Utc>, until: DateTime<Utc>) -> Self
Set temporal validity range (convenience method).
Sourcepub fn viewport(self, viewport: EntityViewport) -> Self
pub fn viewport(self, viewport: EntityViewport) -> Self
Set the viewport context for multi-faceted entity representation.
§Example
ⓘ
use anno_core::{EntityBuilder, EntityType, EntityViewport};
let entity = EntityBuilder::new("Marie Curie", EntityType::Person)
.span(0, 11)
.viewport(EntityViewport::Academic)
.build();
assert_eq!(entity.viewport, Some(EntityViewport::Academic));Trait Implementations§
Source§impl Clone for EntityBuilder
impl Clone for EntityBuilder
Source§fn clone(&self) -> EntityBuilder
fn clone(&self) -> EntityBuilder
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 moreAuto Trait Implementations§
impl Freeze for EntityBuilder
impl RefUnwindSafe for EntityBuilder
impl Send for EntityBuilder
impl Sync for EntityBuilder
impl Unpin for EntityBuilder
impl UnsafeUnpin for EntityBuilder
impl UnwindSafe for EntityBuilder
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