Package-level declarations

Types

Link copied to clipboard
class AntonymGuard(antonyms: Set<Pair<String, String>> = Vocabulary.ANTONYMS) : MatchGuard

Rejects matches where one prompt asks for the opposite of the other.

Link copied to clipboard
class DirectionGuard(cues: Set<String> = Vocabulary.DIRECTIONAL_CUES, stopwords: Set<String> = Vocabulary.STOPWORDS) : MatchGuard

Rejects matches where the same words appear in an order that reverses the question.

Link copied to clipboard
class EntityGuard(stopwords: Set<String> = Vocabulary.STOPWORDS, sentenceOpeners: Set<String> = Vocabulary.SENTENCE_OPENERS, nonEntityCapitals: Set<String> = Vocabulary.NON_ENTITY_CAPITALS) : MatchGuard

Rejects matches that talk about different named things.

Link copied to clipboard
sealed interface GuardVerdict

A guard's decision about one candidate match.

Link copied to clipboard
data class GuardVocabulary(val stopwords: Set<String>, val sentenceOpeners: Set<String>, val nonEntityCapitals: Set<String>, val negationMarkers: Set<String>, val antonyms: Set<Pair<String, String>>, val temporalMarkers: Set<String>, val scopeMarkers: Set<String>, val directionalCues: Set<String>, val units: Map<String, MeasurementUnit>)

The complete set of word lists the standard guards read from, bundled so a whole language can be swapped in one object.

Link copied to clipboard
class LengthRatioGuard(maxRatio: Double = DEFAULT_MAX_RATIO) : MatchGuard

Rejects matches where one prompt is far longer than the other.

Link copied to clipboard
class LexicalDivergenceGuard(minOverlap: Double = DEFAULT_MIN_OVERLAP, minTokens: Int = DEFAULT_MIN_TOKENS, stopwords: Set<String> = Vocabulary.STOPWORDS) : MatchGuard

Rejects matches whose prompts share too few meaningful words. The backstop under the specialised guards: it catches the swaps nobody wrote a rule for.

Link copied to clipboard
interface MatchGuard

A veto on a candidate match that already cleared the similarity threshold.

Link copied to clipboard

Ready-made guard sets for dev.kmemo.SemanticCache.

Link copied to clipboard
data class MeasurementUnit(val canonical: String, val dimension: String)

A unit of measure: its canonical name, and the kind of quantity it measures.

Link copied to clipboard
class NegationGuard(markers: Set<String> = Vocabulary.NEGATION_MARKERS, stopwords: Set<String> = Vocabulary.STOPWORDS) : MatchGuard

Rejects matches where one prompt is negated and the other is not.

Link copied to clipboard

Rejects matches whose prompts do not contain the same numbers.

Link copied to clipboard
class ScopeGuard(markers: Set<String> = Vocabulary.SCOPE_MARKERS) : MatchGuard

Rejects matches that ask for the same subject in a different shape.

Link copied to clipboard
class SubstitutionGuard(minTokens: Int = DEFAULT_MIN_TOKENS, stopwords: Set<String> = Vocabulary.STOPWORDS, units: Map<String, MeasurementUnit> = Vocabulary.UNITS) : MatchGuard

Rejects matches whose prompts are identical except for one word.

Link copied to clipboard
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.

Link copied to clipboard
class UnitGuard(units: Map<String, MeasurementUnit> = Vocabulary.UNITS) : MatchGuard

Rejects matches whose prompts mention different units or currencies.

Link copied to clipboard

Curated GuardVocabulary packs for the highest-traffic languages, and a forLocale lookup.

Link copied to clipboard
object Vocabulary