TemporalGuard

class TemporalGuard(markers: Set<String> = Vocabulary.TEMPORAL_MARKERS, stopwords: Set<String> = Vocabulary.STOPWORDS) : MatchGuard

Rejects matches that pin the question to different moments in time.

"What is the weather in Chicago today?" and "What is the weather in Chicago tomorrow?" are the same question about a different day, and a cache that cannot tell them apart will confidently serve yesterday's forecast forever.

Only absolute references count — see Vocabulary.TEMPORAL_MARKERS for why next and last are excluded. Year numbers are already handled by NumericGuard, so this guard covers the words that carry a date without carrying a digit.

Constructors

Link copied to clipboard
constructor(markers: Set<String> = Vocabulary.TEMPORAL_MARKERS, stopwords: Set<String> = Vocabulary.STOPWORDS)

Properties

Link copied to clipboard
open override val name: String

Short stable identifier, surfaced in dev.kmemo.CacheLookup.Miss.detail.

Functions

Link copied to clipboard
open override fun evaluate(query: String, candidate: String): GuardVerdict

Judges serving the response cached for candidate in answer to query.