@natlibfi/melinda-record-matching 4.4.0-alpha.1 → 5.0.0-alpha.1

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.
Files changed (107) hide show
  1. package/.github/workflows/melinda-node-tests.yml +13 -9
  2. package/LICENSE.txt +21 -165
  3. package/README.md +2 -2
  4. package/eslint.config.js +52 -0
  5. package/example.env +4 -0
  6. package/package.json +29 -79
  7. package/src/candidate-search/candidate-search-utils.js +1 -28
  8. package/src/candidate-search/choose-queries.js +93 -0
  9. package/src/candidate-search/index.js +85 -119
  10. package/src/candidate-search/{index.spec.js → index.test.js} +30 -43
  11. package/src/candidate-search/query-list/bib.js +54 -55
  12. package/src/candidate-search/query-list/bib.test.js +38 -0
  13. package/src/candidate-search/query-list/component.js +127 -0
  14. package/src/candidate-search/query-list/index.js +31 -35
  15. package/src/cli.js +177 -0
  16. package/src/index.js +27 -68
  17. package/src/{index.spec.js → index.test.js} +11 -42
  18. package/src/match-detection/features/bib/all-source-ids.js +2 -29
  19. package/src/match-detection/features/bib/authors.js +5 -30
  20. package/src/match-detection/features/bib/bibliographic-level.js +0 -27
  21. package/src/match-detection/features/bib/host-component.js +0 -27
  22. package/src/match-detection/features/bib/index.js +16 -43
  23. package/src/match-detection/features/bib/index.test.js +52 -0
  24. package/src/match-detection/features/bib/isbn.js +2 -29
  25. package/src/match-detection/features/bib/issn.js +1 -28
  26. package/src/match-detection/features/bib/language.js +5 -32
  27. package/src/match-detection/features/bib/media-type.js +2 -28
  28. package/src/match-detection/features/bib/melinda-id.js +1 -28
  29. package/src/match-detection/features/bib/melinda-identifier-factory.js +5 -32
  30. package/src/match-detection/features/bib/other-standard-identifier.js +1 -28
  31. package/src/match-detection/features/bib/publication-time-allow-cons-years-multi.js +7 -34
  32. package/src/match-detection/features/bib/publication-time-allow-cons-years.js +1 -28
  33. package/src/match-detection/features/bib/publication-time.js +2 -28
  34. package/src/match-detection/features/bib/record-type.js +0 -27
  35. package/src/match-detection/features/bib/standard-identifier-factory.js +1 -28
  36. package/src/match-detection/features/bib/title-version-original.js +2 -28
  37. package/src/match-detection/features/bib/title.js +6 -34
  38. package/src/match-detection/features/index.js +1 -28
  39. package/src/match-detection/index.js +1 -28
  40. package/src/match-detection/{index.spec.js → index.test.js} +9 -35
  41. package/src/matching-utils.js +8 -37
  42. package/dist/candidate-search/candidate-search-utils.js +0 -55
  43. package/dist/candidate-search/candidate-search-utils.js.map +0 -1
  44. package/dist/candidate-search/index.js +0 -254
  45. package/dist/candidate-search/index.js.map +0 -1
  46. package/dist/candidate-search/index.spec.js +0 -144
  47. package/dist/candidate-search/index.spec.js.map +0 -1
  48. package/dist/candidate-search/query-list/bib.js +0 -439
  49. package/dist/candidate-search/query-list/bib.js.map +0 -1
  50. package/dist/candidate-search/query-list/bib.spec.js +0 -64
  51. package/dist/candidate-search/query-list/bib.spec.js.map +0 -1
  52. package/dist/candidate-search/query-list/index.js +0 -66
  53. package/dist/candidate-search/query-list/index.js.map +0 -1
  54. package/dist/index.js +0 -579
  55. package/dist/index.js.map +0 -1
  56. package/dist/index.spec.js +0 -127
  57. package/dist/index.spec.js.map +0 -1
  58. package/dist/match-detection/features/bib/all-source-ids.js +0 -119
  59. package/dist/match-detection/features/bib/all-source-ids.js.map +0 -1
  60. package/dist/match-detection/features/bib/authors.js +0 -113
  61. package/dist/match-detection/features/bib/authors.js.map +0 -1
  62. package/dist/match-detection/features/bib/bibliographic-level.js +0 -42
  63. package/dist/match-detection/features/bib/bibliographic-level.js.map +0 -1
  64. package/dist/match-detection/features/bib/host-component.js +0 -42
  65. package/dist/match-detection/features/bib/host-component.js.map +0 -1
  66. package/dist/match-detection/features/bib/index.js +0 -119
  67. package/dist/match-detection/features/bib/index.js.map +0 -1
  68. package/dist/match-detection/features/bib/index.spec.js +0 -93
  69. package/dist/match-detection/features/bib/index.spec.js.map +0 -1
  70. package/dist/match-detection/features/bib/isbn.js +0 -77
  71. package/dist/match-detection/features/bib/isbn.js.map +0 -1
  72. package/dist/match-detection/features/bib/issn.js +0 -51
  73. package/dist/match-detection/features/bib/issn.js.map +0 -1
  74. package/dist/match-detection/features/bib/language.js +0 -141
  75. package/dist/match-detection/features/bib/language.js.map +0 -1
  76. package/dist/match-detection/features/bib/media-type.js +0 -83
  77. package/dist/match-detection/features/bib/media-type.js.map +0 -1
  78. package/dist/match-detection/features/bib/melinda-id.js +0 -48
  79. package/dist/match-detection/features/bib/melinda-id.js.map +0 -1
  80. package/dist/match-detection/features/bib/melinda-identifier-factory.js +0 -89
  81. package/dist/match-detection/features/bib/melinda-identifier-factory.js.map +0 -1
  82. package/dist/match-detection/features/bib/other-standard-identifier.js +0 -52
  83. package/dist/match-detection/features/bib/other-standard-identifier.js.map +0 -1
  84. package/dist/match-detection/features/bib/publication-time-allow-cons-years-multi.js +0 -256
  85. package/dist/match-detection/features/bib/publication-time-allow-cons-years-multi.js.map +0 -1
  86. package/dist/match-detection/features/bib/publication-time-allow-cons-years.js +0 -71
  87. package/dist/match-detection/features/bib/publication-time-allow-cons-years.js.map +0 -1
  88. package/dist/match-detection/features/bib/publication-time.js +0 -48
  89. package/dist/match-detection/features/bib/publication-time.js.map +0 -1
  90. package/dist/match-detection/features/bib/record-type.js +0 -45
  91. package/dist/match-detection/features/bib/record-type.js.map +0 -1
  92. package/dist/match-detection/features/bib/standard-identifier-factory.js +0 -215
  93. package/dist/match-detection/features/bib/standard-identifier-factory.js.map +0 -1
  94. package/dist/match-detection/features/bib/title-version-original.js +0 -79
  95. package/dist/match-detection/features/bib/title-version-original.js.map +0 -1
  96. package/dist/match-detection/features/bib/title.js +0 -98
  97. package/dist/match-detection/features/bib/title.js.map +0 -1
  98. package/dist/match-detection/features/index.js +0 -11
  99. package/dist/match-detection/features/index.js.map +0 -1
  100. package/dist/match-detection/index.js +0 -201
  101. package/dist/match-detection/index.js.map +0 -1
  102. package/dist/match-detection/index.spec.js +0 -91
  103. package/dist/match-detection/index.spec.js.map +0 -1
  104. package/dist/matching-utils.js +0 -143
  105. package/dist/matching-utils.js.map +0 -1
  106. package/src/candidate-search/query-list/bib.spec.js +0 -54
  107. package/src/match-detection/features/bib/index.spec.js +0 -78
@@ -1,37 +1,10 @@
1
- /**
2
- *
3
- * @licstart The following is the entire license notice for the JavaScript code in this file.
4
- *
5
- * Melinda record matching modules for Javascript
6
- *
7
- * Copyright (C) 2020-2023 University Of Helsinki (The National Library Of Finland)
8
- *
9
- * This file is part of melinda-record-matching-js
10
- *
11
- * melinda-record-matching-js program is free software: you can redistribute it and/or modify
12
- * it under the terms of the GNU Lesser General Public License as
13
- * published by the Free Software Foundation, either version 3 of the
14
- * License, or (at your option) any later version.
15
- *
16
- * melinda-record-matching-js is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU Lesser General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU Affero General Public License
22
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
- *
24
- * @licend The above is the entire license notice
25
- * for the JavaScript code in this file.
26
- *
27
- */
28
-
29
- import {expect} from 'chai';
1
+ import assert from 'node:assert';
2
+ import {describe} from 'node:test';
3
+ import createDebugLogger from 'debug';
30
4
  import {READERS} from '@natlibfi/fixura';
31
5
  import generateTests from '@natlibfi/fixugen-http-client';
32
6
  import {MarcRecord} from '@natlibfi/marc-record';
33
- import createMatchInterface, {matchDetection} from '.';
34
- import createDebugLogger from 'debug';
7
+ import createMatchInterface, {matchDetection} from './index.js';
35
8
 
36
9
  const debug = createDebugLogger('@natlibfi/melinda-record-matching:index:test');
37
10
  const debugData = debug.extend('data');
@@ -39,7 +12,7 @@ const debugData = debug.extend('data');
39
12
  describe('INDEX', () => {
40
13
  generateTests({
41
14
  callback,
42
- path: [__dirname, '..', 'test-fixtures', 'index'],
15
+ path: [import.meta.dirname, '..', 'test-fixtures', 'index'],
43
16
  recurse: false,
44
17
  fixura: {
45
18
  reader: READERS.JSON
@@ -58,19 +31,18 @@ describe('INDEX', () => {
58
31
  const {matches, matchStatus, nonMatches, conversionFailures, candidateCount} = await match({record});
59
32
  debugData(`Matches: ${matches.length}, Status: ${matchStatus.status}/${matchStatus.stopReason}, NonMatches: ${nonMatches ? nonMatches.length : 'not returned'}, ConversionFailures: ${conversionFailures ? conversionFailures.length : 'not returned'}`);
60
33
 
61
- expect(matchStatus.status).to.eql(expectedMatchStatus);
62
- expect(matchStatus.stopReason).to.eql(expectedStopReason);
63
- expect(candidateCount).to.eql(expectedCandidateCount);
34
+ assert.equal(matchStatus.status, expectedMatchStatus);
35
+ assert.equal(matchStatus.stopReason, expectedStopReason);
36
+ assert.equal(candidateCount, expectedCandidateCount);
64
37
 
65
38
  const formattedMatchResult = formatRecordResults(matches);
66
- expect(formattedMatchResult).to.eql(expectedMatches);
39
+ assert.deepStrictEqual(formattedMatchResult, expectedMatches);
67
40
 
68
41
  const formattedNonMatchResult = formatRecordResults(nonMatches);
69
- expect(formattedNonMatchResult).to.eql(expectedNonMatches);
42
+ assert.deepStrictEqual(formattedNonMatchResult, expectedNonMatches);
70
43
 
71
- // eslint-disable-next-line functional/no-conditional-statements
72
44
  if (expectedFailures) {
73
- expect(conversionFailures).to.eql(expectedFailures);
45
+ assert.deepStrictEqual(conversionFailures, expectedFailures);
74
46
  }
75
47
 
76
48
  function formatOptions() {
@@ -108,8 +80,5 @@ describe('INDEX', () => {
108
80
  record: newRecord.toObject()
109
81
  };
110
82
  }
111
-
112
-
113
83
  }
114
-
115
84
  });
@@ -1,33 +1,6 @@
1
- /**
2
- *
3
- * @licstart The following is the entire license notice for the JavaScript code in this file.
4
- *
5
- * Melinda record matching modules for Javascript
6
- *
7
- * Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)
8
- *
9
- * This file is part of melinda-record-matching-js
10
- *
11
- * melinda-record-matching-js program is free software: you can redistribute it and/or modify
12
- * it under the terms of the GNU Lesser General Public License as
13
- * published by the Free Software Foundation, either version 3 of the
14
- * License, or (at your option) any later version.
15
- *
16
- * melinda-record-matching-js is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU Lesser General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU Affero General Public License
22
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
- *
24
- * @licend The above is the entire license notice
25
- * for the JavaScript code in this file.
26
- *
27
- */
28
1
 
29
2
  import createDebugLogger from 'debug';
30
- import {validateSidFieldSubfieldCounts, getSubfieldValues} from '../../../matching-utils';
3
+ import {validateSidFieldSubfieldCounts, getSubfieldValues} from '../../../matching-utils.js';
31
4
 
32
5
  const debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features:all-source-ids');
33
6
  const debugData = debug.extend('data');
@@ -98,7 +71,7 @@ export default () => ({
98
71
  debugData(`Comparing ${JSON.stringify(a)} and ${JSON.stringify(b)}`);
99
72
 
100
73
  const matches = a.filter(sidA => b.some(sidB => sidA.sourceDb === sidB.sourceDb &&
101
- sidA.sourceId === sidB.sourceId));
74
+ sidA.sourceId === sidB.sourceId));
102
75
  debugData(`Matches (${matches.length}): ${JSON.stringify(matches)}`);
103
76
 
104
77
  const mismatches = a.filter(sidA => b.some(sidB => sidA.sourceDb === sidB.sourceDb &&
@@ -1,33 +1,8 @@
1
- /**
2
- *
3
- * @licstart The following is the entire license notice for the JavaScript code in this file.
4
- *
5
- * Melinda record matching modules for Javascript
6
- *
7
- * Copyright (C) 2020-2022 University Of Helsinki (The National Library Of Finland)
8
- *
9
- * This file is part of melinda-record-matching-js
10
- *
11
- * melinda-record-matching-js program is free software: you can redistribute it and/or modify
12
- * it under the terms of the GNU Lesser General Public License as
13
- * published by the Free Software Foundation, either version 3 of the
14
- * License, or (at your option) any later version.
15
- *
16
- * melinda-record-matching-js is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU Lesser General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU Affero General Public License
22
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
- *
24
- * @licend The above is the entire license notice
25
- * for the JavaScript code in this file.
26
- *
27
- */
28
-
29
- import {LevenshteinDistance as leven} from 'natural';
30
- import {testStringOrNumber} from '../../../matching-utils';
1
+
2
+
3
+ import naturalPkg from 'natural';
4
+ const {LevenshteinDistance: leven} = naturalPkg;
5
+ import {testStringOrNumber} from '../../../matching-utils.js';
31
6
 
32
7
  // We should extract also organisational authors (110/710)
33
8
 
@@ -1,30 +1,3 @@
1
- /**
2
- *
3
- * @licstart The following is the entire license notice for the JavaScript code in this file.
4
- *
5
- * Melinda record matching modules for Javascript
6
- *
7
- * Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)
8
- *
9
- * This file is part of melinda-record-matching-js
10
- *
11
- * melinda-record-matching-js program is free software: you can redistribute it and/or modify
12
- * it under the terms of the GNU Lesser General Public License as
13
- * published by the Free Software Foundation, either version 3 of the
14
- * License, or (at your option) any later version.
15
- *
16
- * melinda-record-matching-js is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU Lesser General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU Affero General Public License
22
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
- *
24
- * @licend The above is the entire license notice
25
- * for the JavaScript code in this file.
26
- *
27
- */
28
1
 
29
2
  export default () => ({
30
3
  name: 'Bibliographic level',
@@ -1,30 +1,3 @@
1
- /**
2
- *
3
- * @licstart The following is the entire license notice for the JavaScript code in this file.
4
- *
5
- * Melinda record matching modules for Javascript
6
- *
7
- * Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)
8
- *
9
- * This file is part of melinda-record-matching-js
10
- *
11
- * melinda-record-matching-js program is free software: you can redistribute it and/or modify
12
- * it under the terms of the GNU Lesser General Public License as
13
- * published by the Free Software Foundation, either version 3 of the
14
- * License, or (at your option) any later version.
15
- *
16
- * melinda-record-matching-js is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU Lesser General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU Affero General Public License
22
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
- *
24
- * @licend The above is the entire license notice
25
- * for the JavaScript code in this file.
26
- *
27
- */
28
1
 
29
2
  export default () => ({
30
3
  name: 'Host/Component record',
@@ -1,44 +1,17 @@
1
- /**
2
- *
3
- * @licstart The following is the entire license notice for the JavaScript code in this file.
4
- *
5
- * Melinda record matching modules for Javascript
6
- *
7
- * Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)
8
- *
9
- * This file is part of melinda-record-matching-js
10
- *
11
- * melinda-record-matching-js program is free software: you can redistribute it and/or modify
12
- * it under the terms of the GNU Lesser General Public License as
13
- * published by the Free Software Foundation, either version 3 of the
14
- * License, or (at your option) any later version.
15
- *
16
- * melinda-record-matching-js is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU Lesser General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU Affero General Public License
22
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
- *
24
- * @licend The above is the entire license notice
25
- * for the JavaScript code in this file.
26
- *
27
- */
28
1
 
29
- export {default as hostComponent} from './host-component';
30
- export {default as isbn} from './isbn';
31
- export {default as issn} from './issn';
32
- export {default as otherStandardIdentifier} from './other-standard-identifier';
33
- export {default as title} from './title';
34
- export {default as titleVersionOriginal} from './title-version-original';
35
- export {default as authors} from './authors';
36
- export {default as recordType} from './record-type';
37
- export {default as publicationTime} from './publication-time';
38
- export {default as publicationTimeAllowConsYears} from './publication-time-allow-cons-years';
39
- export {default as publicationTimeAllowConsYearsMulti} from './publication-time-allow-cons-years-multi';
40
- export {default as language} from './language';
41
- export {default as bibliographicLevel} from './bibliographic-level';
42
- export {default as melindaId} from './melinda-id';
43
- export {default as allSourceIds} from './all-source-ids';
44
- export {default as mediaType} from './media-type';
2
+ export {default as hostComponent} from './host-component.js';
3
+ export {default as isbn} from './isbn.js';
4
+ export {default as issn} from './issn.js';
5
+ export {default as otherStandardIdentifier} from './other-standard-identifier.js';
6
+ export {default as title} from './title.js';
7
+ export {default as titleVersionOriginal} from './title-version-original.js';
8
+ export {default as authors} from './authors.js';
9
+ export {default as recordType} from './record-type.js';
10
+ export {default as publicationTime} from './publication-time.js';
11
+ export {default as publicationTimeAllowConsYears} from './publication-time-allow-cons-years.js';
12
+ export {default as publicationTimeAllowConsYearsMulti} from './publication-time-allow-cons-years-multi.js';
13
+ export {default as language} from './language.js';
14
+ export {default as bibliographicLevel} from './bibliographic-level.js';
15
+ export {default as melindaId} from './melinda-id.js';
16
+ export {default as allSourceIds} from './all-source-ids.js';
17
+ export {default as mediaType} from './media-type.js';
@@ -0,0 +1,52 @@
1
+
2
+ import assert from 'node:assert';
3
+ import {describe} from 'node:test';
4
+ import createDebugLogger from 'debug';
5
+ import generateTests from '@natlibfi/fixugen';
6
+ import {READERS} from '@natlibfi/fixura';
7
+ import {MarcRecord} from '@natlibfi/marc-record';
8
+ import * as features from './index.js';
9
+
10
+
11
+ const debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features/bib:test');
12
+ const debugData = debug.extend('data');
13
+
14
+
15
+ describe('match-detection/features/bib/', () => {
16
+ generateTests({
17
+ path: [import.meta.dirname, '..', '..', '..', '..', 'test-fixtures', 'match-detection', 'features', 'bib'],
18
+ useMetadataFile: true,
19
+ fixura: {
20
+ reader: READERS.JSON
21
+ },
22
+
23
+ callback: ({enabled = true, feature, options, type, ...expectations}) => {
24
+
25
+ if (!enabled) {
26
+ return;
27
+ }
28
+
29
+ debug(`Testing: ${feature} ${type}`);
30
+
31
+ if (type === 'extract') {
32
+ const {expectedFeatures, inputRecord} = expectations;
33
+ const record = new MarcRecord(inputRecord, {subfieldValues: false});
34
+ debugData(`Record: ${record}`);
35
+ const {extract} = features[feature](options);
36
+
37
+ assert.deepStrictEqual(extract({record}), expectedFeatures);
38
+ return;
39
+ }
40
+
41
+ if (type === 'compare') {
42
+ const {featuresA, featuresB, expectedPoints} = expectations;
43
+ const {compare} = features[feature](options);
44
+
45
+ assert.equal(compare(featuresA, featuresB), expectedPoints);
46
+ return;
47
+ }
48
+
49
+ throw new Error(`Invalid type ${type}`);
50
+ }
51
+ });
52
+ });
@@ -1,34 +1,7 @@
1
- /**
2
- *
3
- * @licstart The following is the entire license notice for the JavaScript code in this file.
4
- *
5
- * Melinda record matching modules for Javascript
6
- *
7
- * Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)
8
- *
9
- * This file is part of melinda-record-matching-js
10
- *
11
- * melinda-record-matching-js program is free software: you can redistribute it and/or modify
12
- * it under the terms of the GNU Lesser General Public License as
13
- * published by the Free Software Foundation, either version 3 of the
14
- * License, or (at your option) any later version.
15
- *
16
- * melinda-record-matching-js is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU Lesser General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU Affero General Public License
22
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
- *
24
- * @licend The above is the entire license notice
25
- * for the JavaScript code in this file.
26
- *
27
- */
28
1
 
29
- import createInterface from './standard-identifier-factory';
30
- import {parse as isbnParse} from 'isbn3';
31
2
  import createDebugLogger from 'debug';
3
+ import {parse as isbnParse} from 'isbn3';
4
+ import createInterface from './standard-identifier-factory.js';
32
5
 
33
6
  const debug = createDebugLogger(`@natlibfi/melinda-record-matching:match-detection:features:standard-identifiers:ISBN`);
34
7
  const debugData = debug.extend('data');
@@ -1,32 +1,5 @@
1
- /**
2
- *
3
- * @licstart The following is the entire license notice for the JavaScript code in this file.
4
- *
5
- * Melinda record matching modules for Javascript
6
- *
7
- * Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)
8
- *
9
- * This file is part of melinda-record-matching-js
10
- *
11
- * melinda-record-matching-js program is free software: you can redistribute it and/or modify
12
- * it under the terms of the GNU Lesser General Public License as
13
- * published by the Free Software Foundation, either version 3 of the
14
- * License, or (at your option) any later version.
15
- *
16
- * melinda-record-matching-js is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU Lesser General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU Affero General Public License
22
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
- *
24
- * @licend The above is the entire license notice
25
- * for the JavaScript code in this file.
26
- *
27
- */
28
1
 
29
- import createInterface from './standard-identifier-factory';
2
+ import createInterface from './standard-identifier-factory.js';
30
3
 
31
4
  export default () => {
32
5
  const {extract, compare} = createInterface({pattern: /^022$/u, subfieldCodes: ['a', 'z', 'y']});
@@ -1,33 +1,6 @@
1
- /**
2
- *
3
- * @licstart The following is the entire license notice for the JavaScript code in this file.
4
- *
5
- * Melinda record matching modules for Javascript
6
- *
7
- * Copyright (C) 2020-2023 University Of Helsinki (The National Library Of Finland)
8
- *
9
- * This file is part of melinda-record-matching-js
10
- *
11
- * melinda-record-matching-js program is free software: you can redistribute it and/or modify
12
- * it under the terms of the GNU Lesser General Public License as
13
- * published by the Free Software Foundation, either version 3 of the
14
- * License, or (at your option) any later version.
15
- *
16
- * melinda-record-matching-js is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU Lesser General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU Affero General Public License
22
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
- *
24
- * @licend The above is the entire license notice
25
- * for the JavaScript code in this file.
26
- *
27
- */
28
1
 
29
2
  import createDebugLogger from 'debug';
30
- import {getMatchCounts} from '../../../matching-utils';
3
+ import {getMatchCounts} from '../../../matching-utils.js';
31
4
 
32
5
  const debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features:language');
33
6
  const debugData = debug.extend('data');
@@ -39,10 +12,10 @@ export default () => ({
39
12
 
40
13
  const value008 = get008Value();
41
14
  const values041 = get041Values();
42
- debugData(`${label} 008: ${JSON.stringify(value008)}, 041: ${JSON.stringify(values041)}`);
15
+ debugData(`${label}: 008: ${JSON.stringify(value008)}, 041: ${JSON.stringify(values041)}`);
43
16
 
44
17
  if (!value008 && values041.length < 1) {
45
- debugData(`{$label} No actual values found`);
18
+ debugData(`${label}: No actual values found`);
46
19
  return [];
47
20
  }
48
21
 
@@ -53,14 +26,14 @@ export default () => ({
53
26
 
54
27
  function get008Value() {
55
28
  const value = record.get(/^008$/u)?.[0]?.value || undefined;
56
- debugData(`${label} 008 value: ${value}`);
29
+ debugData(`${label}: 008 value: ${value}`);
57
30
 
58
31
  if (!value) {
59
32
  return undefined;
60
33
  }
61
34
 
62
35
  const code = value.slice(35, 38);
63
- debugData(`${label} 008 code: ${code}`);
36
+ debugData(`${label}: 008 code: ${code}`);
64
37
  return isLangCodeForALanguage(code) ? code : undefined;
65
38
  }
66
39
 
@@ -1,31 +1,5 @@
1
1
  /* eslint-disable max-statements */
2
- /**
3
- *
4
- * @licstart The following is the entire license notice for the JavaScript code in this file.
5
- *
6
- * Melinda record matching modules for Javascript
7
- *
8
- * Copyright (C) 2020-2022 University Of Helsinki (The National Library Of Finland)
9
- *
10
- * This file is part of melinda-record-matching-js
11
- *
12
- * melinda-record-matching-js program is free software: you can redistribute it and/or modify
13
- * it under the terms of the GNU Lesser General Public License as
14
- * published by the Free Software Foundation, either version 3 of the
15
- * License, or (at your option) any later version.
16
- *
17
- * melinda-record-matching-js is distributed in the hope that it will be useful,
18
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
- * GNU Lesser General Public License for more details.
21
- *
22
- * You should have received a copy of the GNU Affero General Public License
23
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
24
- *
25
- * @licend The above is the entire license notice
26
- * for the JavaScript code in this file.
27
- *
28
- */
2
+
29
3
 
30
4
  import createDebugLogger from 'debug';
31
5
 
@@ -39,7 +13,7 @@ export default () => ({
39
13
  debugData(`Record (${label}): ${JSON.stringify(record)}`);
40
14
  debugData(`RecordExternal: ${JSON.stringify(recordExternal)}`);
41
15
  const values337 = get337Values();
42
- debug(`${label} 337 $b values: ${JSON.stringify(values337)}`);
16
+ debug(`${label}: 337 $b values: ${JSON.stringify(values337)}`);
43
17
 
44
18
  return values337;
45
19
 
@@ -1,32 +1,5 @@
1
- /**
2
- *
3
- * @licstart The following is the entire license notice for the JavaScript code in this file.
4
- *
5
- * Melinda record matching modules for Javascript
6
- *
7
- * Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)
8
- *
9
- * This file is part of melinda-record-matching-js
10
- *
11
- * melinda-record-matching-js program is free software: you can redistribute it and/or modify
12
- * it under the terms of the GNU Lesser General Public License as
13
- * published by the Free Software Foundation, either version 3 of the
14
- * License, or (at your option) any later version.
15
- *
16
- * melinda-record-matching-js is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU Lesser General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU Affero General Public License
22
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
- *
24
- * @licend The above is the entire license notice
25
- * for the JavaScript code in this file.
26
- *
27
- */
28
1
 
29
- import createInterface from './melinda-identifier-factory';
2
+ import createInterface from './melinda-identifier-factory.js';
30
3
 
31
4
  export default () => {
32
5
  const {extract, compare} = createInterface();
@@ -1,33 +1,6 @@
1
- /**
2
- *
3
- * @licstart The following is the entire license notice for the JavaScript code in this file.
4
- *
5
- * Melinda record matching modules for Javascript
6
- *
7
- * Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)
8
- *
9
- * This file is part of melinda-record-matching-js
10
- *
11
- * melinda-record-matching-js program is free software: you can redistribute it and/or modify
12
- * it under the terms of the GNU Lesser General Public License as
13
- * published by the Free Software Foundation, either version 3 of the
14
- * License, or (at your option) any later version.
15
- *
16
- * melinda-record-matching-js is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU Lesser General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU Affero General Public License
22
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
- *
24
- * @licend The above is the entire license notice
25
- * for the JavaScript code in this file.
26
- *
27
- */
28
1
 
29
2
  import createDebugLogger from 'debug';
30
- import {getMelindaIdsF035} from '../../../matching-utils';
3
+ import {getMelindaIdsF035} from '../../../matching-utils.js';
31
4
 
32
5
  // 003+001 FI-MELINDA <melinda-id>
33
6
  // 035 $a (FI-MELINDA)<melinda-id>
@@ -65,25 +38,25 @@ export default () => {
65
38
  function compare(a, b) {
66
39
 
67
40
  if (a.isMelindaRecord && b.isMelindaRecord &&
68
- a.f001 === b.f001) {
41
+ a.f001 === b.f001) {
69
42
  debugData(`Melinda record's A f001 ${a.f001} matches Melinda record's B f001 ${a.f001}`);
70
43
  return 1;
71
44
  }
72
45
 
73
46
  if (a.isMelindaRecord && typeof b.f035MelindaIds !== 'undefined' &&
74
- b.f035MelindaIds.some(id => id === a.f001)) {
47
+ b.f035MelindaIds.some(id => id === a.f001)) {
75
48
  debugData(`Melinda record's A f001 ${a.f001} matches record B f035 ${JSON.stringify(b.f035MelindaIds)}`);
76
49
  return 1;
77
50
  }
78
51
 
79
52
  if (b.isMelindaRecord && typeof a.f035MelindaIds !== 'undefined' &&
80
- a.f035MelindaIds.some(id => id === b.f001)) {
53
+ a.f035MelindaIds.some(id => id === b.f001)) {
81
54
  debugData(`Melinda record's B f001 ${b.f001} matches record A f035 ${JSON.stringify(a.f035MelindaIds)}`);
82
55
  return 1;
83
56
  }
84
57
 
85
58
  if (typeof a.f035MelindaIds !== 'undefined' && typeof b.f035MelindaIds !== 'undefined' &&
86
- a.f035MelindaIds.some(idA => b.f035MelindaIds.some(idB => idB === idA))) {
59
+ a.f035MelindaIds.some(idA => b.f035MelindaIds.some(idB => idB === idA))) {
87
60
  debugData(`Record A f035 ${JSON.stringify(a.f035MelindaIds)} matches record B f035 ${JSON.stringify(b.f035MelindaIds)}`);
88
61
  return 1;
89
62
  }
@@ -1,32 +1,5 @@
1
- /**
2
- *
3
- * @licstart The following is the entire license notice for the JavaScript code in this file.
4
- *
5
- * Melinda record matching modules for Javascript
6
- *
7
- * Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)
8
- *
9
- * This file is part of melinda-record-matching-js
10
- *
11
- * melinda-record-matching-js program is free software: you can redistribute it and/or modify
12
- * it under the terms of the GNU Lesser General Public License as
13
- * published by the Free Software Foundation, either version 3 of the
14
- * License, or (at your option) any later version.
15
- *
16
- * melinda-record-matching-js is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU Lesser General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU Affero General Public License
22
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
- *
24
- * @licend The above is the entire license notice
25
- * for the JavaScript code in this file.
26
- *
27
- */
28
1
 
29
- import createInterface from './standard-identifier-factory';
2
+ import createInterface from './standard-identifier-factory.js';
30
3
 
31
4
  // DEVELOP: we should compare indicators and sf2 for f024
32
5