UNPKG

@himorishige/noren-core

Version:

Core PII detection, masking, and tokenization library built on Web Standards

29 lines 1.2 kB
/** * Context-based scoring system for PII detection accuracy improvement * Analyzes surrounding text to determine likelihood of genuine PII */ import type { PiiType } from './types.js'; export interface ContextAnalysis { score: number; positiveMatches: string[]; negativeMatches: string[]; confidence: number; reasoning: string[]; } /** * Calculate context score for a PII candidate */ export declare function calculateContextScore(surroundingText: string, piiType: PiiType, _windowSize?: number): ContextAnalysis; /** * Extract surrounding text for context analysis */ export declare function extractSurroundingText(fullText: string, matchStart: number, matchEnd: number, windowSize?: number): string; /** * Determine if context score meets threshold for acceptance */ export declare function meetsContextThreshold(analysis: ContextAnalysis, piiType: PiiType, strictness?: 'fast' | 'balanced' | 'strict'): boolean; /** * Enhanced context analysis that includes pattern-based scoring */ export declare function analyzeContextWithPatterns(surroundingText: string, candidate: string, piiType: PiiType): ContextAnalysis; //# sourceMappingURL=context-scoring.d.ts.map