/** * Semantic text analysis utilities. * * Provides stemming, negation handling, constraint normalization, * and enhanced keyword extraction for semantic matching. */ /** * Stem a single word using simplified Porter-like rules. * * @param word - Word to stem (should be lowercase) * @returns Stemmed word */ export declare function stem(word: string): string; /** * Stem all words in a text. * * @param text - Text to stem * @returns Text with all words stemmed */ export declare function stemText(text: string): string; /** * Extract keywords with stemming applied. * * @param text - Text to extract keywords from * @returns Set of stemmed keywords */ export declare function extractStemmedKeywords(text: string): Set; /** * Calculate keyword overlap with stemming. * * @param text1 - First text * @param text2 - Second text * @returns Overlap percentage (0-100) */ export declare function calculateStemmedKeywordOverlap(text1: string, text2: string): number; /** * Result of negation analysis. */ export interface NegationResult { /** Negated words found in text */ negatedWords: string[]; /** Whether the overall sentiment is negated */ isNegated: boolean; /** Original text with negations marked */ markedText: string; } /** * Analyze text for negation patterns. * * @param text - Text to analyze * @returns Negation analysis result */ export declare function analyzeNegation(text: string): NegationResult; /** * Check if a severity keyword is negated in the text. * * @param text - Text to check * @param keyword - Severity keyword to look for * @returns True if keyword is negated */ export declare function isSeverityNegated(text: string, keyword: string): boolean; /** * Extract severity from text with negation handling. * * @param text - Text to extract severity from * @returns Extracted severity level */ export declare function extractSeverityWithNegation(text: string): 'low' | 'medium' | 'high' | 'critical'; /** * Normalized constraint value. */ export interface NormalizedConstraint { /** Original constraint string */ original: string; /** Type of constraint */ type: 'size' | 'time' | 'rate' | 'count' | 'unknown'; /** Numeric value */ value: number; /** Normalized unit */ unit: string; /** Value in base units (bytes for size, ms for time, per-second for rate) */ baseValue: number; } /** * Parse and normalize a constraint value. * * @param constraint - Constraint string (e.g., "10MB", "30 seconds", "100 requests/min") * @returns Normalized constraint or undefined if not parseable */ export declare function normalizeConstraint(constraint: string): NormalizedConstraint | undefined; /** * Compare two constraint values with unit normalization. * * @param a - First constraint * @param b - Second constraint * @returns Similarity score (0-100) */ export declare function compareConstraints(a: string | undefined, b: string | undefined): number; /** * Extended security category keywords including new categories. */ export declare const EXTENDED_SECURITY_KEYWORDS: Record; /** * Extract security category from text using extended keywords. * * @param text - Text to analyze * @returns Detected security category */ export declare function extractSecurityCategoryExtended(text: string): string; /** * Check if two texts are semantically similar considering stemming. * * @param text1 - First text * @param text2 - Second text * @param threshold - Minimum similarity threshold (0-100, default 60) * @returns True if texts are similar */ export declare function areSemanticallySimular(text1: string, text2: string, threshold?: number): boolean; /** * Database type qualifiers that distinguish different injection types. */ export type DatabaseQualifier = 'sql' | 'nosql' | 'mongodb' | 'redis' | 'generic'; /** * Direction qualifiers for file/data operations. */ export type DirectionQualifier = 'upload' | 'download' | 'read' | 'write' | 'generic'; /** * Timeout type qualifiers. */ export type TimeoutQualifier = 'connection' | 'read' | 'write' | 'request' | 'response' | 'idle' | 'generic'; /** * Polarity indicator for assertions (positive vs negative statements). */ export type Polarity = 'positive' | 'negative' | 'neutral'; /** * Full qualifier extraction result. */ export interface QualifierResult { database: DatabaseQualifier; direction: DirectionQualifier; timeout: TimeoutQualifier; polarity: Polarity; isNegated: boolean; rateTimeUnit: 'second' | 'minute' | 'hour' | 'day' | 'unknown'; } /** * Extract database type qualifier from text. * Distinguishes SQL from NoSQL/MongoDB/Redis etc. */ export declare function extractDatabaseQualifier(text: string): DatabaseQualifier; /** * Extract direction qualifier from text. * Distinguishes upload from download, read from write. */ export declare function extractDirectionQualifier(text: string): DirectionQualifier; /** * Extract timeout type qualifier from text. * Distinguishes connection timeout from read/write/request timeouts. */ export declare function extractTimeoutQualifier(text: string): TimeoutQualifier; /** * Extract rate limit time unit from text. * Distinguishes per-second from per-minute from per-hour limits. */ export declare function extractRateTimeUnit(text: string): 'second' | 'minute' | 'hour' | 'day' | 'unknown'; /** * Detect overall polarity of an assertion. * Returns 'negative' if the statement is negated/denied. */ export declare function detectPolarity(text: string): Polarity; /** * Check if a security finding or assertion is negated. * Returns true if the text explicitly denies the assertion/vulnerability. */ export declare function isSecurityFindingNegated(text: string): boolean; /** * Extract all qualifiers from text. * Provides comprehensive context for semantic comparison. */ export declare function extractQualifiers(text: string): QualifierResult; /** * Compare qualifiers between two texts. * Returns a compatibility score (0-100). */ export declare function compareQualifiers(text1: string, text2: string): { score: number; incompatibilities: string[]; }; /** * Check if two texts have compatible qualifiers for matching. * Returns false if there are critical incompatibilities. */ export declare function qualifiersCompatible(text1: string, text2: string): boolean; //# sourceMappingURL=semantic.d.ts.map