Skip to content

Commit 057aff8

Browse files
committed
Fix systematical typo: treshold -> threshold
1 parent dea4b6a commit 057aff8

File tree

11 files changed

+20
-20
lines changed

11 files changed

+20
-20
lines changed

src/cli.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ async function cli() {
5555
debug(JSON.stringify(args));
5656

5757
const detection = {
58-
treshold: 0.9,
58+
threshold: 0.9,
5959
strategy: generateStrategy(searchType)
6060
};
6161

src/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export default ({detection: detectionOptions, search: searchOptions, maxMatches
124124
// - candidate.record
125125
// - probability
126126
// - strategy (if returnStrategy option is true)
127-
// - treshold (if returnStrategy option is true)
127+
// - threshold (if returnStrategy option is true)
128128
// - matchQuery (if returnQuery option is true)
129129
// failures: array of conversionFailures from candidate-search and matchErrors from matchDetection in error format {status, payload: {message, id}} if returnFailures is true
130130

@@ -257,7 +257,7 @@ export default ({detection: detectionOptions, search: searchOptions, maxMatches
257257

258258
if (detectionResult.match || returnNonMatches) {
259259
debug(`${detectionResult.match ? `Record ${candidateId} (${newRecordCount}/${recordSetSize}) is a match!` : `Record ${candidateId} (${newRecordCount}/${recordSetSize}) is NOT a match!`}`);
260-
debugData(`Strategy: ${JSON.stringify(detectionResult.strategy)}, Treshold: ${JSON.stringify(detectionResult.treshold)}`);
260+
debugData(`Strategy: ${JSON.stringify(detectionResult.strategy)}, Threshold: ${JSON.stringify(detectionResult.threshold)}`);
261261

262262
const matchResult = {
263263
probability: detectionResult.probability,
@@ -268,7 +268,7 @@ export default ({detection: detectionOptions, search: searchOptions, maxMatches
268268
};
269269
const strategyResult = {
270270
strategy: detectionResult.strategy,
271-
treshold: detectionResult.treshold
271+
threshold: detectionResult.threshold
272272
};
273273
const newMatch = returnStrategy ? {...matchResult, ...strategyResult} : {...matchResult};
274274

src/match-detection/features/bib/authors.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {testStringOrNumber} from '../../../matching-utils.js';
66

77
// We should extract also organisational authors (110/710)
88

9-
export default ({nameTreshold = 10} = {}) => ({
9+
export default ({nameThreshold = 10} = {}) => ({
1010
name: 'Authors',
1111
extract: ({record}) => {
1212
//const label = recordExternal && recordExternal.label ? recordExternal.label : 'record';
@@ -58,7 +58,7 @@ export default ({nameTreshold = 10} = {}) => ({
5858
const maxLength = getMaxLength();
5959
const percentage = distance / maxLength * 100;
6060

61-
return percentage <= nameTreshold;
61+
return percentage <= nameThreshold;
6262

6363
function getMaxLength() {
6464
return a.length > b.length ? a.length : b.length;

src/match-detection/features/bib/title-version-original.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import createDebugLogger from 'debug';
33
import naturalPkg from 'natural';
44
const {LevenshteinDistance: leven} = naturalPkg;
55

6-
export default ({treshold = 10} = {}) => ({
6+
export default ({threshold = 10} = {}) => ({
77
name: 'titleVersionOriginal',
88
extract: ({record}) => {
99
const title = getTitle();
@@ -38,7 +38,7 @@ export default ({treshold = 10} = {}) => ({
3838

3939
debug(`'${a}' vs '${b}': Max length = ${maxLength}, distance = ${distance}, percentage = ${percentage}`);
4040

41-
if (percentage <= treshold) {
41+
if (percentage <= threshold) {
4242
return 0.3;
4343
}
4444

src/match-detection/features/bib/title.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detecti
77
const debugData = debug.extend('data');
88

99

10-
export default ({treshold = 10} = {}) => ({
10+
export default ({threshold = 10} = {}) => ({
1111
name: 'Title',
1212
extract: ({record, recordExternal}) => {
1313
const label = recordExternal && recordExternal.label ? recordExternal.label : 'record';
@@ -56,7 +56,7 @@ export default ({treshold = 10} = {}) => ({
5656

5757
debug(`'${a}' vs '${b}': Max length = ${maxLength}, distance = ${distance}, percentage = ${percentage}`);
5858

59-
if (percentage <= treshold) {
59+
if (percentage <= threshold) {
6060
return 0.3;
6161
}
6262

src/match-detection/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import * as features from './features/index.js';
44

55
export {features};
66

7-
export default ({strategy, treshold = 0.9}, returnStrategy = false, localSettings = {}) => ({recordA, recordB, recordAExternal = {}, recordBExternal = {}}) => {
7+
export default ({strategy, threshold = 0.9}, returnStrategy = false, localSettings = {}) => ({recordA, recordB, recordAExternal = {}, recordBExternal = {}}) => {
88
const minProbabilityQuantifier = 0.5;
99

1010
const debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection');
1111
const debugData = debug.extend('data');
1212

13-
debugData(`Strategy: ${JSON.stringify(strategy)}, Treshold: ${JSON.stringify(treshold)}, ReturnStrategy: ${JSON.stringify(returnStrategy)}`);
13+
debugData(`Strategy: ${JSON.stringify(strategy)}, Threshold: ${JSON.stringify(threshold)}, ReturnStrategy: ${JSON.stringify(returnStrategy)}`);
1414
debugData(`Records: A: ${recordA}\nB: ${recordB}`);
1515
debug(`Externals: A: ${JSON.stringify(recordAExternal)}, B: ${JSON.stringify(recordBExternal)}`);
1616
// We could add here labels for records if we didn't get external labels
@@ -43,8 +43,8 @@ export default ({strategy, treshold = 0.9}, returnStrategy = false, localSetting
4343

4444
if (similarityVector.some(v => v >= minProbabilityQuantifier)) {
4545
const probability = calculateProbability(similarityVector);
46-
debug(`probability: ${probability} (Treshold: ${treshold})`);
47-
return returnResult({match: probability >= treshold, probability});
46+
debug(`probability: ${probability} (Threshold: ${threshold})`);
47+
return returnResult({match: probability >= threshold, probability});
4848
}
4949

5050
debugData(`No feature yielded minimum probability amount of points (${minProbabilityQuantifier})`);
@@ -58,7 +58,7 @@ export default ({strategy, treshold = 0.9}, returnStrategy = false, localSetting
5858
function returnResult(result) {
5959
if (returnStrategy) {
6060
debug(`Returning detection strategy with the result`);
61-
const resultWithStrategy = {match: result.match, probability: result.probability, strategy: formatStrategy(strategy), treshold};
61+
const resultWithStrategy = {match: result.match, probability: result.probability, strategy: formatStrategy(strategy), threshold};
6262
debugData(`${JSON.stringify(resultWithStrategy)}`);
6363
return resultWithStrategy;
6464
}

test-fixtures/index/10/expectedMatches.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"Title",
66
"ISBN"
77
],
8-
"treshold": 0.9,
8+
"threshold": 0.9,
99
"candidate": {
1010
"id": "000019641",
1111
"record": {

test-fixtures/index/10/expectedNonMatches.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"Title",
66
"ISBN"
77
],
8-
"treshold": 0.9,
8+
"threshold": 0.9,
99
"candidate": {
1010
"id": "000019642",
1111
"record": {

test-fixtures/match-detection/features/bib/title-version-original/04/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"description": "Comparison should return points for matching titles (Different values, distance under treshold)",
2+
"description": "Comparison should return points for matching titles (Different values, distance under threshold)",
33
"feature": "titleVersionOriginal",
44
"type": "compare",
55
"expectedPoints": 0.3,

test-fixtures/match-detection/features/bib/title/c-02/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"description": "Comparison should return plus points for matching titles (Different values, distance under treshold)",
2+
"description": "Comparison should return plus points for matching titles (Different values, distance under threshold)",
33
"feature": "title",
44
"type": "compare",
55
"expectedPoints": 0.3,

0 commit comments

Comments
 (0)