/** * Term matching utilities for compound negative/reflection attribution. * * Why this module exists (PR3 motivation): * 라운드 1~3 리뷰에서 반복적으로 발견된 문제의 근본 원인은 * `response.toLowerCase().includes(term.toLowerCase())` substring 매칭이었다. * * Matching model by script (라운드 3 정리): * * | term script | 매칭 방식 | boundary 의미 | * |-------------|--------------------------------------------|------------------------------| * | 영어/숫자 | lookaround regex `(?; /** * Filter terms usable for word-boundary matching. * * - Drops non-strings (cache file can be hand-edited to contain garbage). * - Drops terms that are too long (MAX_TERM_LENGTH guard — RegExp DoS 방어). * - Drops terms that are too short to be meaningful (English < 3, Korean < 2). * - Drops meta terms that match almost any Bash error (NEGATIVE_TERM_BLOCKLIST). * - NFC normalize on ingest. * * Drop 사유는 debug 레벨로 로그해 cache 변조 또는 extractor 버그를 운영 중에 * 추적할 수 있게 한다 (silent drop은 디버깅이 불가능). */ export declare function filterMatchableTerms(raw: unknown[]): string[]; /** * Check whether `term` matches inside `text` at a word boundary. * * 주의: 호출자는 일반적으로 `matchesInPrecomputed`를 써서 NFC normalize와 * stem Set 계산을 재사용하는 게 효율적. 이 함수는 단발성 호출 또는 테스트용. */ export declare function matchesAtWordBoundary(text: string, term: string): boolean; /** * Classify a solution's match strength against `response`. * * Returns one of: * - 'strong' : identifier 매칭으로 고신뢰 (길이 ≥4 단독, 또는 id≥2, 또는 id+tag) * - 'multi' : tag 2개 이상 매칭 (identifier 없음) * - 'weak' : tag 1개 OR 짧은 identifier(<4) 단독 * - 'none' : 매칭 없음 * * Callers (negative attribution, reflection) should only attribute on 'strong' * or 'multi'. 'weak' is over-attribution-prone and must be ignored. */ export type MatchStrength = 'none' | 'weak' | 'multi' | 'strong'; export interface MatchClassification { strength: MatchStrength; matchedIdentifiers: string[]; matchedTags: string[]; } export declare function classifyMatch(response: string, identifiers: unknown[], tags: unknown[]): MatchClassification; /** * Convenience wrapper for callers that only care about "should attribute?". */ export declare function shouldAttribute(classification: MatchClassification): boolean;