added detailed scores

This commit is contained in:
Karma Riuk
2025-05-08 14:21:59 +02:00
parent 5c3957dfad
commit faffbecfe9

View File

@ -27,17 +27,20 @@ export const evaluate_comments = async (answers, percent_cb, finished_cb) => {
console.error(`id: "${id}" is not present in the dataset`); console.error(`id: "${id}" is not present in the dataset`);
continue; continue;
} }
const references = referenceMap[id]; const paraphrases = referenceMap[id];
let maxScore = 0; let maxScore = 0;
for (let reference of references) { const scores = []
const score = bleu(reference, generated_comment, 4); // TODO: ask prof what number show be here for (const paraphrase of paraphrases) {
const score = bleu(paraphrase, generated_comment, 4); // TODO: ask prof what number show be here
scores.push(score);
maxScore = Math.max(score, maxScore); maxScore = Math.max(score, maxScore);
console.log(`bleu score: ${score}`); console.log(`bleu score: ${score}`);
} }
results[id] = { results[id] = {
"proposed comment": generated_comment,
"max bleu score": maxScore, "max bleu score": maxScore,
"bleu scores": scores,
"proposed comment": generated_comment,
}; };
console.log(`Max bleu score: ${maxScore}`); console.log(`Max bleu score: ${maxScore}`);