From 93a42ea343c25a750bb1d8f1bdfb7df44a808d74 Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Tue, 20 Oct 2026 22:23:19 +0000 Subject: [PATCH] adjust fuzzy alignment weights and normalize against larger of input sizes --- web/scripts/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/web/scripts/index.js b/web/scripts/index.js index 2d97a0e..6b665bd 100644 --- a/web/scripts/index.js +++ b/web/scripts/index.js @@ -268,15 +268,16 @@ function sortInstances () { else if (searchCriteria === "fuzzy") { const penalties = { m: 0, - x: 1, - o: 0, + x: 2, + o: 3, e: 1 }; criteria = (item, query) => { // lower is better const { score, CIGAR } = wfa.wfAlign(query, item, penalties, true); const alignment = wfa.DecodeCIGAR(CIGAR); - return { score: score / item.length, alignment }; + const maxlength = Math.max(item.length, query.length); + return { score: score / maxlength, alignment }; }; } @@ -306,6 +307,7 @@ function sortInstances () { for (let i = 0; i < instances.length; i++) { container.appendChild(instances[i]); + console.log(instances[i].dataset.name, instances[i].searchQueryResult.score) instances[i].update(); } }