acp-kernel 0.0.62-pr.247.92 → 0.0.63-pr.229.94
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -3919,7 +3919,11 @@ function build(text) {
|
|
|
3919
3919
|
}
|
|
3920
3920
|
function docFeatures(text) {
|
|
3921
3921
|
const hit = cache.get(text);
|
|
3922
|
-
if (hit)
|
|
3922
|
+
if (hit) {
|
|
3923
|
+
cache.delete(text);
|
|
3924
|
+
cache.set(text, hit);
|
|
3925
|
+
return hit;
|
|
3926
|
+
}
|
|
3923
3927
|
const f = build(text);
|
|
3924
3928
|
if (text.length > 0 && text.length <= capChars) {
|
|
3925
3929
|
while (cachedChars + text.length > capChars && cache.size > 0) {
|
|
@@ -4030,8 +4034,8 @@ var hybridAlgorithm = {
|
|
|
4030
4034
|
score(docs, query) {
|
|
4031
4035
|
const bm = bm25Algorithm.score(docs, query);
|
|
4032
4036
|
const fz = fuzzyAlgorithm.score(docs, query);
|
|
4033
|
-
const maxBm =
|
|
4034
|
-
const maxFz =
|
|
4037
|
+
const maxBm = bm.reduce((m, r) => r.score > m ? r.score : m, 1e-9);
|
|
4038
|
+
const maxFz = fz.reduce((m, r) => r.score > m ? r.score : m, 1e-9);
|
|
4035
4039
|
const bmMap = new Map(bm.map((r) => [r.ref, r.score / maxBm]));
|
|
4036
4040
|
const fzMap = new Map(fz.map((r) => [r.ref, r.score / maxFz]));
|
|
4037
4041
|
return docs.map((d) => ({
|