adjust fuzzy alignment weights and normalize against larger of input sizes
tronnet/workflows: Code Style -- Web Components / style-web (push) Failing after 14s

This commit is contained in:
alu committed 2026-10-20 22:23:19 +00:00
1 parent b92aabb052
commit 744620a00e
1 file changed
+5 -3
+5 -3
View File
@@ -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();
}
}