|
|
|
@ -237,6 +237,77 @@ module.exports.tests.confidenceScore = function(test, common) {
|
|
|
|
|
t.equal(res.data[0].confidence, 0.1, 'score was set'); |
|
|
|
|
t.end(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test('city input granularity with locality result should set score to 1.0', function(t) { |
|
|
|
|
var req = { |
|
|
|
|
clean: { |
|
|
|
|
parsed_text: { |
|
|
|
|
city: 'city name', |
|
|
|
|
state: 'state name' |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
var res = { |
|
|
|
|
data: [{ |
|
|
|
|
layer: 'locality' |
|
|
|
|
}], |
|
|
|
|
meta: { |
|
|
|
|
query_type: 'fallback' |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
confidenceScore(req, res, function() {}); |
|
|
|
|
t.equal(res.data[0].confidence, 1.0, 'score was set'); |
|
|
|
|
t.end(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test('city input granularity with region fallback should set score to 0.3', function(t) { |
|
|
|
|
var req = { |
|
|
|
|
clean: { |
|
|
|
|
parsed_text: { |
|
|
|
|
city: 'city name', |
|
|
|
|
state: 'state name' |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
var res = { |
|
|
|
|
data: [{ |
|
|
|
|
layer: 'region' |
|
|
|
|
}], |
|
|
|
|
meta: { |
|
|
|
|
query_type: 'fallback' |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
confidenceScore(req, res, function() {}); |
|
|
|
|
t.equal(res.data[0].confidence, 0.3, 'score was set'); |
|
|
|
|
t.end(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test('city input granularity with country fallback should set score to 0.1', function(t) { |
|
|
|
|
var req = { |
|
|
|
|
clean: { |
|
|
|
|
parsed_text: { |
|
|
|
|
city: 'city name', |
|
|
|
|
state: 'state name', |
|
|
|
|
country: 'country name' |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
var res = { |
|
|
|
|
data: [{ |
|
|
|
|
layer: 'country' |
|
|
|
|
}], |
|
|
|
|
meta: { |
|
|
|
|
query_type: 'fallback' |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
confidenceScore(req, res, function() {}); |
|
|
|
|
t.equal(res.data[0].confidence, 0.1, 'score was set'); |
|
|
|
|
t.end(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
module.exports.all = function (tape, common) { |
|
|
|
|