acp-kernel 0.0.82-pr.186.215 → 0.0.82-pr.229.213

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
@@ -5377,7 +5377,11 @@ function build(text) {
5377
5377
  }
5378
5378
  function docFeatures(text) {
5379
5379
  const hit = cache.get(text);
5380
- if (hit) return hit;
5380
+ if (hit) {
5381
+ cache.delete(text);
5382
+ cache.set(text, hit);
5383
+ return hit;
5384
+ }
5381
5385
  const f = build(text);
5382
5386
  if (text.length > 0 && text.length <= capChars) {
5383
5387
  while (cachedChars + text.length > capChars && cache.size > 0) {
@@ -5488,8 +5492,8 @@ var hybridAlgorithm = {
5488
5492
  score(docs, query) {
5489
5493
  const bm = bm25Algorithm.score(docs, query);
5490
5494
  const fz = fuzzyAlgorithm.score(docs, query);
5491
- const maxBm = Math.max(...bm.map((r) => r.score), 1e-9);
5492
- const maxFz = Math.max(...fz.map((r) => r.score), 1e-9);
5495
+ const maxBm = bm.reduce((m, r) => r.score > m ? r.score : m, 1e-9);
5496
+ const maxFz = fz.reduce((m, r) => r.score > m ? r.score : m, 1e-9);
5493
5497
  const bmMap = new Map(bm.map((r) => [r.ref, r.score / maxBm]));
5494
5498
  const fzMap = new Map(fz.map((r) => [r.ref, r.score / maxFz]));
5495
5499
  return docs.map((d) => ({