Add AI-powered company name matching using Claude API
Replace fuzzy string matching with semantic AI matching to fix false positives where similar-sounding but different companies were matched (e.g., "Families First CiC" incorrectly matching "FAMILIES AGAINST CONFORMITY LTD"). Changes: - Add ICompanyNameMatcherService interface and AICompanyNameMatcherService implementation using Claude Sonnet 4 for semantic company name comparison - Add SemanticMatchResult and related models for AI match results - Update CompanyVerifierService to use AI matching with fuzzy fallback - Add detection for public sector employers, charities, and self-employed entries that cannot be verified via Companies House - Update tests to work with new AI matcher integration Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
33
src/TrueCV.Application/Models/SemanticMatchResult.cs
Normal file
33
src/TrueCV.Application/Models/SemanticMatchResult.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
namespace TrueCV.Application.Models;
|
||||
|
||||
public record SemanticMatchResult
|
||||
{
|
||||
public required string CandidateCompanyName { get; init; }
|
||||
public required string CandidateCompanyNumber { get; init; }
|
||||
public required int ConfidenceScore { get; init; }
|
||||
public required string MatchType { get; init; } // Exact, TradingName, Subsidiary, Parent, NoMatch
|
||||
public required string Reasoning { get; init; }
|
||||
public bool IsMatch => ConfidenceScore >= 70;
|
||||
}
|
||||
|
||||
public record CompanyMatchRequest
|
||||
{
|
||||
public required string CVCompanyName { get; init; }
|
||||
public required List<CompanyCandidate> Candidates { get; init; }
|
||||
}
|
||||
|
||||
public record CompanyCandidate
|
||||
{
|
||||
public required string CompanyName { get; init; }
|
||||
public required string CompanyNumber { get; init; }
|
||||
public string? CompanyStatus { get; init; }
|
||||
public string? DateOfCreation { get; init; }
|
||||
}
|
||||
|
||||
public record AIMatchResponse
|
||||
{
|
||||
public required string BestMatchCompanyNumber { get; init; }
|
||||
public required int ConfidenceScore { get; init; }
|
||||
public required string MatchType { get; init; }
|
||||
public required string Reasoning { get; init; }
|
||||
}
|
||||
Reference in New Issue
Block a user