NegationGuard
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.
Negation is close to invisible to an embedding model: "is this column nullable" and "is this column not nullable" are one short function word apart, and that word carries the entire answer.
The test is presence, not count, so two differently-phrased negatives ("no such file" and "file not found") still match each other. Contractions are caught by an n't substring test, which survives any tokenizer that splits on apostrophes.
Properties
Link copied to clipboard
Short stable identifier, surfaced in dev.kmemo.CacheLookup.Miss.detail.