feat: Detect fake UK universities using naming patterns
Add detection for institutions that follow UK university naming conventions (e.g., "University of the Peak District") but aren't in the recognised institutions list. These are now flagged as "Suspicious" with a -15 point penalty instead of just "Unknown". 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -78,6 +78,26 @@ public sealed class EducationVerifierService : IEducationVerifierService
|
||||
};
|
||||
}
|
||||
|
||||
// Check if this looks like a UK university name but isn't recognised
|
||||
// This catches fake institutions like "University of the Peak District"
|
||||
if (LooksLikeUKUniversity(institution))
|
||||
{
|
||||
return new EducationVerificationResult
|
||||
{
|
||||
ClaimedInstitution = institution,
|
||||
Status = "Suspicious",
|
||||
IsVerified = false,
|
||||
IsUnaccredited = false,
|
||||
IsSuspicious = true,
|
||||
VerificationNotes = "Institution uses UK university naming convention but is not found in the register of recognised UK institutions",
|
||||
ClaimedStartDate = education.StartDate,
|
||||
ClaimedEndDate = education.EndDate,
|
||||
DatesArePlausible = true,
|
||||
ClaimedQualification = education.Qualification,
|
||||
ClaimedSubject = education.Subject
|
||||
};
|
||||
}
|
||||
|
||||
// Not in our database - could be international or unrecognised
|
||||
var isUnknownInstitution = string.IsNullOrWhiteSpace(institution) ||
|
||||
institution.Equals("Unknown Institution", StringComparison.OrdinalIgnoreCase) ||
|
||||
@@ -99,6 +119,82 @@ public sealed class EducationVerifierService : IEducationVerifierService
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if an institution name follows UK university naming conventions.
|
||||
/// If it does but isn't in the recognised list, it's likely a fake UK institution.
|
||||
/// </summary>
|
||||
private static bool LooksLikeUKUniversity(string? institution)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(institution))
|
||||
return false;
|
||||
|
||||
var lower = institution.ToLowerInvariant().Trim();
|
||||
|
||||
// Skip if explicitly marked as foreign/international
|
||||
if (lower.Contains("foreign") || lower.Contains("international"))
|
||||
return false;
|
||||
|
||||
// "University of the [X]" is a distinctly British naming pattern
|
||||
// Examples: University of the West of England, University of the Highlands and Islands
|
||||
// Fake examples: University of the Peak District, University of the Cotswolds
|
||||
if (lower.StartsWith("university of the "))
|
||||
return true;
|
||||
|
||||
// UK-specific naming patterns that are less common internationally
|
||||
if (lower.Contains(" metropolitan university")) // Manchester Metropolitan University
|
||||
return true;
|
||||
if (lower.Contains(" brookes university")) // Oxford Brookes
|
||||
return true;
|
||||
if (lower.Contains(" hallam university")) // Sheffield Hallam
|
||||
return true;
|
||||
if (lower.Contains(" beckett university")) // Leeds Beckett
|
||||
return true;
|
||||
if (lower.Contains(" napier university")) // Edinburgh Napier
|
||||
return true;
|
||||
if (lower.Contains(" trent university")) // Nottingham Trent
|
||||
return true;
|
||||
if (lower.StartsWith("royal college of ")) // Royal College of Art, etc.
|
||||
return true;
|
||||
|
||||
// Check for UK place names that don't have real universities
|
||||
// These are well-known UK regions/places used by diploma mills
|
||||
var fakeUkPatterns = new[]
|
||||
{
|
||||
"university of devonshire",
|
||||
"university of cornwall", // No "University of Cornwall" - only Falmouth
|
||||
"university of wiltshire",
|
||||
"university of dorset",
|
||||
"university of hampshire",
|
||||
"university of norfolk",
|
||||
"university of suffolk", // Note: There IS a University of Suffolk now
|
||||
"university of berkshire",
|
||||
"university of shropshire",
|
||||
"university of herefordshire",
|
||||
"university of rutland",
|
||||
"university of cumbria", // This one exists - keep for now
|
||||
"university of england",
|
||||
"university of britain",
|
||||
"university of the lake district",
|
||||
"university of the cotswolds",
|
||||
"university of the peak district",
|
||||
"university of the dales",
|
||||
"university of the moors",
|
||||
"university of the fens",
|
||||
"university of london south",
|
||||
"university of london north",
|
||||
"university of london east",
|
||||
"university of london west",
|
||||
};
|
||||
|
||||
foreach (var pattern in fakeUkPatterns)
|
||||
{
|
||||
if (lower.Contains(pattern))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<EducationVerificationResult> VerifyAll(
|
||||
List<EducationEntry> education,
|
||||
List<EmploymentEntry>? employment = null)
|
||||
|
||||
Reference in New Issue
Block a user