pub struct AbstractTemporalExpression {
pub text: String,
pub expression_type: TemporalExpressionType,
pub granularity: TemporalGranularity,
pub grounded_range: Option<(DateTime<Utc>, DateTime<Utc>)>,
pub grounding_confidence: f64,
pub requires_context: bool,
}Expand description
An abstract temporal expression with full metadata.
This is the temporal analog to abstract entities in a hierarchical clustering layer - it captures not just when something happened, but how precisely we know when, and what kind of temporal reference it is.
Fields§
§text: StringOriginal text of the temporal expression
expression_type: TemporalExpressionTypeType of temporal expression
granularity: TemporalGranularityGranularity level
grounded_range: Option<(DateTime<Utc>, DateTime<Utc>)>Grounded time range (if resolvable) For “January 2024”, this would be (2024-01-01, 2024-01-31)
grounding_confidence: f64Confidence in the grounding (0.0 to 1.0)
requires_context: boolWhether this requires external context to resolve
Implementations§
Source§impl AbstractTemporalExpression
impl AbstractTemporalExpression
Sourcepub fn absolute(
text: impl Into<String>,
granularity: TemporalGranularity,
) -> Self
pub fn absolute( text: impl Into<String>, granularity: TemporalGranularity, ) -> Self
Create a new absolute temporal expression.
Sourcepub fn relative(text: impl Into<String>, offset_days: i32) -> Self
pub fn relative(text: impl Into<String>, offset_days: i32) -> Self
Create a relative temporal expression.
Sourcepub fn fuzzy(text: impl Into<String>, direction: FuzzyDirection) -> Self
pub fn fuzzy(text: impl Into<String>, direction: FuzzyDirection) -> Self
Create a fuzzy temporal expression.
Trait Implementations§
Source§impl Clone for AbstractTemporalExpression
impl Clone for AbstractTemporalExpression
Source§fn clone(&self) -> AbstractTemporalExpression
fn clone(&self) -> AbstractTemporalExpression
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 AbstractTemporalExpression
impl Debug for AbstractTemporalExpression
Source§impl<'de> Deserialize<'de> for AbstractTemporalExpression
impl<'de> Deserialize<'de> for AbstractTemporalExpression
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 AbstractTemporalExpression
impl RefUnwindSafe for AbstractTemporalExpression
impl Send for AbstractTemporalExpression
impl Sync for AbstractTemporalExpression
impl Unpin for AbstractTemporalExpression
impl UnsafeUnpin for AbstractTemporalExpression
impl UnwindSafe for AbstractTemporalExpression
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