Skip to content

Commit

Permalink
Fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
vesameskanen committed Jun 10, 2022
1 parent 8a0ae50 commit 79046f5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions middleware/confidenceScoreDT.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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];
Expand Down

0 comments on commit 79046f5

Please sign in to comment.