pub struct Entity {
pub id: EntityId,
pub name: String,
pub entity_type: String,
pub confidence: f32,
pub mentions: Vec<EntityMention>,
pub embedding: Option<Vec<f32>>,
pub first_mentioned: Option<i64>,
pub last_mentioned: Option<i64>,
pub temporal_validity: Option<TemporalRange>,
}Expand description
An entity extracted from text
Fields§
§id: EntityIdUnique identifier for the entity
name: StringName or label of the entity
entity_type: StringType or category of the entity (e.g., “person”, “organization”)
confidence: f32Confidence score for the entity extraction (0.0-1.0)
mentions: Vec<EntityMention>List of locations where this entity is mentioned
embedding: Option<Vec<f32>>Optional vector embedding for the entity
first_mentioned: Option<i64>First time this entity was mentioned (Unix timestamp)
last_mentioned: Option<i64>Last time this entity was mentioned (Unix timestamp)
temporal_validity: Option<TemporalRange>Temporal validity range (when the entity exists in the real world)
Implementations§
Source§impl Entity
impl Entity
Sourcepub fn new(
id: EntityId,
name: String,
entity_type: String,
confidence: f32,
) -> Self
pub fn new( id: EntityId, name: String, entity_type: String, confidence: f32, ) -> Self
Create a new entity
Sourcepub fn with_mentions(self, mentions: Vec<EntityMention>) -> Self
pub fn with_mentions(self, mentions: Vec<EntityMention>) -> Self
Add mentions to the entity
Sourcepub fn with_embedding(self, embedding: Vec<f32>) -> Self
pub fn with_embedding(self, embedding: Vec<f32>) -> Self
Add an embedding to the entity
Sourcepub fn with_temporal_validity(self, start: i64, end: i64) -> Self
pub fn with_temporal_validity(self, start: i64, end: i64) -> Self
Set temporal validity range for this entity
Sourcepub fn with_mention_times(self, first: i64, last: i64) -> Self
pub fn with_mention_times(self, first: i64, last: i64) -> Self
Set mention timestamps for this entity
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Entity
impl<'de> Deserialize<'de> for Entity
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Entity
impl RefUnwindSafe for Entity
impl Send for Entity
impl Sync for Entity
impl Unpin for Entity
impl UnsafeUnpin for Entity
impl UnwindSafe for Entity
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