From 79046f5d5dfd7ae24d4307f1a5817d5229267a78 Mon Sep 17 00:00:00 2001 From: Vesa Meskanen Date: Fri, 10 Jun 2022 07:26:08 +0300 Subject: [PATCH] Fix bugs --- middleware/confidenceScoreDT.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/middleware/confidenceScoreDT.js b/middleware/confidenceScoreDT.js index bb2aa21d..6d17b1a7 100644 --- a/middleware/confidenceScoreDT.js +++ b/middleware/confidenceScoreDT.js @@ -274,7 +274,7 @@ function checkLanguageNames(text, doc, stripNumbers, tryGenitive) { var textWC = text.split(' ').length; var checkNewBest = function(_text, name, coeff) { - var score = fuzzy.match(_text, name) * score; + var score = fuzzy.match(_text, name) * coeff; logger.debug('#', _text, '|', name, score); if (score >= bestScore ) { bestScore = score; @@ -307,11 +307,11 @@ function checkLanguageNames(text, doc, stripNumbers, tryGenitive) { if(stripNumbers) { name = removeNumbers(name); } - var nameLen = name.length; - + var score = checkNewBest(text, name, 1.0); if (score > genitiveThreshold && tryGenitive) { // don't prefix unless base match is OK var nameWC = name.split(' ').length; - var score = checkNewBest(text, name, 1.0); + var nameLen = name.length; + // prefix with parent admins to catch cases like 'kontulan r-kioski = r-kioski, kontula' for(var key in adminWeights) { var admins = parent[key];