wingbot 3.53.3 → 3.53.4
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/package.json +1 -1
- package/src/AiMatching.js +12 -9
package/package.json
CHANGED
package/src/AiMatching.js
CHANGED
|
@@ -504,11 +504,14 @@ class AiMatching {
|
|
|
504
504
|
? (tot + (entity.end - entity.start))
|
|
505
505
|
: null
|
|
506
506
|
), 0);
|
|
507
|
+
const textLength = req.text().trim().length;
|
|
507
508
|
|
|
508
|
-
|
|
509
|
-
|
|
509
|
+
const useHandicap = textLength <= matchedEntitiesTextLength
|
|
510
|
+
? Math.max(-this.redundantEntityHandicap, baseScore - 1)
|
|
511
|
+
: handicap;
|
|
510
512
|
|
|
511
|
-
|
|
513
|
+
let finalScore = (baseScore - useHandicap)
|
|
514
|
+
* (this.multiMatchGain ** countOfAdditionalItems);
|
|
512
515
|
|
|
513
516
|
if (matchedEntitiesTextLength && textLength) {
|
|
514
517
|
const remainingScore = Math.max(0, Math.min(1, finalScore) - (
|
|
@@ -518,14 +521,14 @@ class AiMatching {
|
|
|
518
521
|
const remainingTextLen = (textLength - matchedEntitiesTextLength);
|
|
519
522
|
const minus = (remainingTextLen / textLength) * remainingScore;
|
|
520
523
|
|
|
521
|
-
// eslint-disable-next-line
|
|
524
|
+
// eslint-disable-next-line max-len,object-curly-newline
|
|
522
525
|
// console.log({ minus, matchedEntitiesTextLength, textLength, remainingScore })
|
|
523
526
|
|
|
524
527
|
finalScore -= minus;
|
|
525
528
|
}
|
|
526
529
|
|
|
527
|
-
// eslint-disable-next-line
|
|
528
|
-
// console.log({ countOfAdditionalItems, multiMatch: this.multiMatchGain ** countOfAdditionalItems, handicap, finalScore, rule, baseScore, score, allOptional, entities, reqEntities, matchedEntitiesTextLength
|
|
530
|
+
// eslint-disable-next-line max-len,object-curly-newline
|
|
531
|
+
// console.log({ countOfAdditionalItems, multiMatch: this.multiMatchGain ** countOfAdditionalItems, handicap, useHandicap, finalScore, rule, baseScore, score, allOptional, entities, reqEntities, matchedEntitiesTextLength });
|
|
529
532
|
|
|
530
533
|
if (finalScore <= 0) {
|
|
531
534
|
return null;
|
|
@@ -609,7 +612,7 @@ class AiMatching {
|
|
|
609
612
|
: (x) => x
|
|
610
613
|
);
|
|
611
614
|
|
|
612
|
-
// eslint-disable-next-line
|
|
615
|
+
// eslint-disable-next-line max-len,object-curly-newline
|
|
613
616
|
// console.log({ wantedEntities, entitiesScore, handicap, matched, minScore, requestIntent });
|
|
614
617
|
|
|
615
618
|
const allOptional = wantedEntities.every((e) => e.optional
|
|
@@ -624,7 +627,7 @@ class AiMatching {
|
|
|
624
627
|
|
|
625
628
|
const score = Math.round((scoreWithHandicap * multiMatchGain) * 10000) / 10000;
|
|
626
629
|
|
|
627
|
-
// eslint-disable-next-line
|
|
630
|
+
// eslint-disable-next-line max-len,object-curly-newline
|
|
628
631
|
// console.log({ IMS: score, normalizedScore, scoreWithHandicap, multiMatchGain, wantedEntities });
|
|
629
632
|
|
|
630
633
|
return {
|
|
@@ -744,7 +747,7 @@ class AiMatching {
|
|
|
744
747
|
}
|
|
745
748
|
}
|
|
746
749
|
|
|
747
|
-
// eslint-disable-next-line
|
|
750
|
+
// eslint-disable-next-line max-len
|
|
748
751
|
// console.log({ wantedEntities, sum, handicap, rl: requestEntities.length, ml: matched.length });
|
|
749
752
|
|
|
750
753
|
// @todo - neni mozne, by doslo k negativnimu handicapu
|