MatchGuards

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

Pick by how much a wrong answer costs you:

PresetUse when
standardDefault. Every guard that pays for itself, tuned to reject no genuine paraphrase.
longPromptsPrompts carry retrieved context. Bounds the one guard that misfires on them.
strictA wrong answer is expensive. Trades hit rate for margin.
noneSimilarity alone. Only with a dev.kmemo.Verifier, or a private benchmark.

standard takes an optional GuardVocabulary or language code, so the same guards run against another language's markers — see Vocabularies for the packs that ship.

Functions

Link copied to clipboard

standard with SubstitutionGuard bounded, for traffic whose prompts carry retrieved context.

longPrompts, reading every marker from vocabulary.

Link copied to clipboard

No guards: the similarity threshold decides alone.

Link copied to clipboard

standard for traffic that is declarative prose rather than questions.

prose, reading every marker from vocabulary.

Link copied to clipboard

standard plus AnswerAnchorGuard, the one guard that reads the candidate's stored answer.

responseAware, reading every marker from vocabulary.

Link copied to clipboard

standard with SubstitutionGuard reading three-word questions, for traffic that is mostly short.

shortQuestions, reading every marker from vocabulary.

Link copied to clipboard

The default set: one guard per way a near-miss slips past a similarity threshold, wired to the English GuardVocabulary.

standard, but reading every marker from vocabulary — the way to run the guards against a non-English language, or a customized marker set. NumericGuard is language-agnostic and takes no markers; every other guard is fed from the pack.

fun standard(language: String): List<MatchGuard>

standard for an ISO 639 language code, using the shipped Vocabularies pack.

Link copied to clipboard

java.util.Locale conveniences for the guard vocabularies.

Link copied to clipboard

standard with the tolerant edges pulled in: prompts must share meaningfully more wording, and a large length gap is enough to refuse on its own.