adjust fuzzy alignment weights and normalize against larger of input sizes
tronnet/workflows: Code Style -- Web Components / style-web (push) Failing after 17s
tronnet/workflows: Code Style -- Web Components / style-web (push) Failing after 17s
This commit is contained in:
1 parent
b92aabb052
commit
93a42ea343
1 file changed
+5
-3
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user