/** * Deciding what a question is asking, before any model runs. * * Some questions are a row lookup, not a reasoning job. "Is this card banned?" * and "what does rule 300.2 say?" both have an answer sitting in a table, and * reading it is faster, free, and impossible to get creatively wrong. * * PRECISION OVER RECALL, EVERYWHERE. A question this cannot classify confidently * returns NONE and falls through to the agent, which can answer it. A question * it classifies WRONGLY produces a confident cited answer about the wrong thing, * and nothing downstream checks it. Every closed word list below is closed for * that reason: one wildcard, and "is the red one banned" resolves "the red" and * answers about a card nobody asked about. */ export type StaticIntent = "RULE_N" | "BANNED" | "BANLIST" | "ERRATA" | "RULINGS" | "NONE"; export type Classification = { intent: StaticIntent; ruleNumber?: string; /** The folded card name the question named. */ cardKey?: string; /** What the reader typed, so an answer can use their capitalisation. */ cardRaw?: string; /** A legality question that also asks whether the text changed. */ alsoErrata?: boolean; /** The clause that asked about the text, which may name a different card. */ errataClause?: string; }; /** * The patterns that vary between games. * * Every game numbers its rules differently, names its formats differently, and * has its own words for "may I play this". Defaults suit a numbered rulebook * with a banned list; override what does not fit. */ export type ClassifyConfig = { /** A rule number, as a regular-expression source. */ ruleNumberPattern: string; /** Words that make a question a legality question. */ legalityWords: string[]; /** Format names, so "in standard" is dropped rather than read as a card name. */ formatWords: string[]; }; export declare const DEFAULT_CLASSIFY_CONFIG: ClassifyConfig; /** * A second clause starts here. * * "can i play X and has its text been changed" asks two questions, and the card * name ends at the conjunction. Name folding already turned a comma into a * space, so the comma form arrives here too. */ declare const CLAUSE_BREAK: RegExp; /** * A question asking whether the printed text changed. * * Matched against the WHOLE question, never against a card name: a card really * can be called "Changing Seasons", and matching the name would make every * question about it a text question. */ declare const ERRATA_CUE: RegExp; /** * A question asking for the published rulings on something. * * DELIBERATELY NARROW. It wants the word, not the idea. "How does this work" * and "what happens if" are rulings questions in spirit, and both belong to the * agent: answering them needs the rules underneath a ruling read and weighed, * which no table lookup does. Widening this cue would hand a reasoning question * a list of near-miss rulings and present it as the answer. */ declare const RULINGS_CUE: RegExp; /** * Classify a question into a static intent and the thing it named. * * BANNED is returned for ANY question that names something and asks a legality * word about it, whether or not that thing turns out to be on the list. The * ABSENCE of a row is an answer the data can give, and routing that case to a * model is what produces a confident verdict with nothing behind it. */ export declare function classify(question: string, config?: ClassifyConfig): Classification; /** Drop the listed opener and closer words. Never empties the key. */ export declare function trimFiller(text: string): string; /** * The card name a TEXT question names, or "" when it names none. * * "has fury rune been reworked" names a card. "has its text been changed" names * nothing: it is about the card the other half of the sentence named. Telling * those apart is what keeps a text claim off a card nobody asked it about. * * Unlike `trimFiller` this MAY return "", because an empty key is the right * answer for a clause built entirely of pronouns. */ export declare function trimErrataClause(clause: string): string; /** * The keys to try for one named card, most literal first. * * The FIRST candidate is always the key exactly as it was captured, so a card * whose printed name really holds "and" or a filler word resolves itself before * any narrowing runs. */ export declare function cardKeyCandidates(cardKey: string): string[]; export { CLAUSE_BREAK, ERRATA_CUE, RULINGS_CUE }; //# sourceMappingURL=static-classify.d.ts.map