/** * Copyright (c) 2019-2025 Mark Sandford * Licensed under the MIT License. See LICENSE and NOTICE files. */ /** * Unified Company Entity Resolution * * Consolidates duplicate name normalization and matching logic from: * - fec-entity-resolution.ts (cleanNameForMatching, expandAbbreviation, levenshteinDistance) * - influence-chain-analyzer.ts (normalizeOrgName, validateTokenOverlap, levenshteinDistance) * * Single canonical implementation for cross-API company name matching * across EPA, OSHA, CFPB, SEC, FEC, and LDA data sources. */ import { IndustrySector } from './industry-taxonomy.js'; export interface ResolvedCompany { canonicalName: string; normalizedName: string; aliases: string[]; sicCodes: string[]; naicsCodes: string[]; sector: IndustrySector | null; cik: string | null; confidence: number; } /** * Normalize a company name for matching. * * Consolidates cleanNameForMatching() (fec-entity-resolution.ts) and * normalizeOrgName() (influence-chain-analyzer.ts) into a single pipeline: * * 1. Trim and uppercase * 2. Strip corporate suffixes (word boundary, all occurrences) * 3. Normalize & to AND * 4. Remove non-word non-space characters * 5. Collapse whitespace * 6. Expand abbreviations (JNJ -> JOHNSON AND JOHNSON) */ export declare function normalizeCompanyName(name: string): string; /** * Compute similarity ratio between two strings (0-1). * 1.0 = identical, 0.0 = completely different. */ export declare function similarityRatio(a: string, b: string): number; /** * Validate that two normalized names share enough word tokens. * * Catches false positives that Levenshtein misses. For example: * "American Health Association" vs "American Heart Association" = 0.90 Levenshtein * But "Health" vs "Heart" = 0.6 token similarity -> correctly rejected. * * Each token from the shorter name must find a close match (>= 0.75 * similarity) in the longer name. At least `threshold` fraction of the * shorter name's tokens must match. */ export declare function validateTokenOverlap(a: string, b: string, threshold?: number): boolean; /** * Check whether two company names refer to the same entity. * * Pipeline: * 1. Normalize both names * 2. Check alias table for canonical matches * 3. Levenshtein similarity with token overlap validation * 4. Optional SIC code cross-validation boost */ export declare function companiesMatch(a: string, b: string, context?: { sicCodeA?: string; sicCodeB?: string; }): { match: boolean; confidence: number; }; /** * Resolve a raw company name to its canonical form. * Uses alias table lookup and SIC/NAICS cross-validation. */ export declare function resolveCompanyName(rawName: string, context?: { sicCode?: string; naicsCode?: string; state?: string; }): ResolvedCompany | null; /** * Batch resolve company names, deduplicating entries that resolve to the same entity. */ export declare function resolveCompanyNames(entries: Array<{ name: string; source: string; context?: { sicCode?: string; naicsCode?: string; state?: string; }; }>): Map; //# sourceMappingURL=company-entity-resolver.d.ts.map