mirror of
https://github.com/xitanggg/open-resume
synced 2024-12-04 20:55:16 +01:00
Improve multi-line summary parsing
This commit is contained in:
parent
68ac64036a
commit
8b5932ec25
@ -54,11 +54,14 @@ export const getTextWithHighestFeatureScore = (
|
||||
) => {
|
||||
const textScores = computeFeatureScores(textItems, featureSets);
|
||||
|
||||
let textWithHighestFeatureScore = "";
|
||||
let textsWithHighestFeatureScore: string[] = [];
|
||||
let highestScore = -Infinity;
|
||||
for (const { text, score } of textScores) {
|
||||
if (score >= highestScore) {
|
||||
if (score > highestScore) {
|
||||
textWithHighestFeatureScore = text;
|
||||
textsWithHighestFeatureScore = [];
|
||||
}
|
||||
textsWithHighestFeatureScore.push(text.trim());
|
||||
highestScore = score;
|
||||
}
|
||||
}
|
||||
@ -66,5 +69,5 @@ export const getTextWithHighestFeatureScore = (
|
||||
if (returnEmptyStringIfHighestScoreIsNotPositive && highestScore <= 0)
|
||||
return ["", textScores] as const;
|
||||
|
||||
return [textWithHighestFeatureScore, textScores] as const;
|
||||
return [textsWithHighestFeatureScore.join(" "), textScores] as const;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user