feat(cv): extend templates and extraction

This commit is contained in:
cesnimda
2026-08-27 15:27:48 +02:00
parent cc76f86482
commit ccd0af908c
15 changed files with 586 additions and 54 deletions
@@ -126,8 +126,15 @@ public sealed partial class ProfileCvController : ControllerBase
AnnotateStructuredCv(sectionFallback, "repair", 0.56);
var heuristicFallback = BuildHeuristicStructuredCv(parseSource, text);
AnnotateStructuredCv(heuristicFallback, "deterministic", 0.68);
var heuristicSummary = heuristicFallback.Summary.ToList();
var heuristicSkills = heuristicFallback.Skills.ToList();
heuristicFallback.Sections = new List<StructuredCvSection>();
var fallback = StructuredCvProfileJson.Merge(heuristicFallback, sectionFallback);
// The section parser deliberately treats comma-separated text as lists. A prose summary is
// better represented by the sentence-aware deterministic parser, otherwise one paragraph
// is duplicated as many comma fragments during fallback merging.
if (heuristicSummary.Count > 0) fallback.Summary = heuristicSummary;
if (heuristicSkills.Count > 0) fallback.Skills = heuristicSkills;
if (classifierFallback is not null)
{
fallback = StructuredCvProfileJson.Merge(classifierFallback, fallback);
@@ -160,7 +167,10 @@ public sealed partial class ProfileCvController : ControllerBase
}
else if (ArePlausibleJobs(merged.Jobs, merged.Contact.FullName))
{
if (ScoreJobs(reparsedJobs, merged.Contact.FullName) > ScoreJobs(merged.Jobs, merged.Contact.FullName))
var firstJobCameFromClassifier = merged.Metadata.Fields.TryGetValue("jobs[0].title", out var firstJobMetadata)
&& string.Equals(firstJobMetadata.Method, "classifier", StringComparison.OrdinalIgnoreCase);
if (!firstJobCameFromClassifier
&& ScoreJobs(reparsedJobs, merged.Contact.FullName) > ScoreJobs(merged.Jobs, merged.Contact.FullName))
{
merged.Jobs = reparsedJobs;
}