@natlibfi/melinda-record-matching 1.0.6 → 2.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 (64) hide show
  1. package/dist/candidate-search/candidate-search-utils.js +58 -0
  2. package/dist/candidate-search/candidate-search-utils.js.map +1 -0
  3. package/dist/candidate-search/index.js +4 -4
  4. package/dist/candidate-search/index.js.map +1 -1
  5. package/dist/candidate-search/index.spec.js +94 -86
  6. package/dist/candidate-search/index.spec.js.map +1 -1
  7. package/dist/candidate-search/query-list/bib.js +103 -20
  8. package/dist/candidate-search/query-list/bib.js.map +1 -1
  9. package/dist/candidate-search/query-list/bib.spec.js +25 -23
  10. package/dist/candidate-search/query-list/bib.spec.js.map +1 -1
  11. package/dist/candidate-search/query-list/index.js +6 -4
  12. package/dist/candidate-search/query-list/index.js.map +1 -1
  13. package/dist/index.js +3 -3
  14. package/dist/index.js.map +1 -1
  15. package/dist/index.spec.js +53 -46
  16. package/dist/index.spec.js.map +1 -1
  17. package/dist/match-detection/features/bib/all-source-ids.js +122 -0
  18. package/dist/match-detection/features/bib/all-source-ids.js.map +1 -0
  19. package/dist/match-detection/features/bib/authors.js.map +1 -1
  20. package/dist/match-detection/features/bib/bibliographic-level.js.map +1 -1
  21. package/dist/match-detection/features/bib/host-component.js.map +1 -1
  22. package/dist/match-detection/features/bib/index.js +32 -16
  23. package/dist/match-detection/features/bib/index.js.map +1 -1
  24. package/dist/match-detection/features/bib/index.spec.js +50 -42
  25. package/dist/match-detection/features/bib/index.spec.js.map +1 -1
  26. package/dist/match-detection/features/bib/isbn.js.map +1 -1
  27. package/dist/match-detection/features/bib/issn.js.map +1 -1
  28. package/dist/match-detection/features/bib/language.js +42 -5
  29. package/dist/match-detection/features/bib/language.js.map +1 -1
  30. package/dist/match-detection/features/bib/melinda-id.js +52 -0
  31. package/dist/match-detection/features/bib/melinda-id.js.map +1 -0
  32. package/dist/match-detection/features/bib/melinda-identifier-factory.js +100 -0
  33. package/dist/match-detection/features/bib/melinda-identifier-factory.js.map +1 -0
  34. package/dist/match-detection/features/bib/other-standard-identifier.js.map +1 -1
  35. package/dist/match-detection/features/bib/publication-time.js.map +1 -1
  36. package/dist/match-detection/features/bib/record-type.js.map +1 -1
  37. package/dist/match-detection/features/bib/standard-identifier-factory.js +8 -0
  38. package/dist/match-detection/features/bib/standard-identifier-factory.js.map +1 -1
  39. package/dist/match-detection/features/bib/title.js.map +1 -1
  40. package/dist/match-detection/features/index.js +2 -2
  41. package/dist/match-detection/index.js +10 -6
  42. package/dist/match-detection/index.js.map +1 -1
  43. package/dist/match-detection/index.spec.js +32 -25
  44. package/dist/match-detection/index.spec.js.map +1 -1
  45. package/dist/matching-utils.js +95 -0
  46. package/dist/matching-utils.js.map +1 -0
  47. package/package.json +26 -29
  48. package/src/candidate-search/candidate-search-utils.js +53 -0
  49. package/src/candidate-search/index.js +1 -1
  50. package/src/candidate-search/index.spec.js +64 -58
  51. package/src/candidate-search/query-list/bib.js +120 -19
  52. package/src/candidate-search/query-list/bib.spec.js +16 -14
  53. package/src/candidate-search/query-list/index.js +3 -1
  54. package/src/index.spec.js +46 -39
  55. package/src/match-detection/features/bib/all-source-ids.js +122 -0
  56. package/src/match-detection/features/bib/index.js +2 -0
  57. package/src/match-detection/features/bib/index.spec.js +32 -23
  58. package/src/match-detection/features/bib/language.js +37 -3
  59. package/src/match-detection/features/bib/melinda-id.js +34 -0
  60. package/src/match-detection/features/bib/melinda-identifier-factory.js +94 -0
  61. package/src/match-detection/features/bib/standard-identifier-factory.js +6 -0
  62. package/src/match-detection/index.js +7 -4
  63. package/src/match-detection/index.spec.js +27 -20
  64. package/src/matching-utils.js +86 -0
@@ -3,6 +3,24 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ Object.defineProperty(exports, "allSourceIds", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _allSourceIds.default;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "authors", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _authors.default;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "bibliographicLevel", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _bibliographicLevel.default;
22
+ }
23
+ });
6
24
  Object.defineProperty(exports, "hostComponent", {
7
25
  enumerable: true,
8
26
  get: function () {
@@ -21,28 +39,22 @@ Object.defineProperty(exports, "issn", {
21
39
  return _issn.default;
22
40
  }
23
41
  });
24
- Object.defineProperty(exports, "otherStandardIdentifier", {
25
- enumerable: true,
26
- get: function () {
27
- return _otherStandardIdentifier.default;
28
- }
29
- });
30
- Object.defineProperty(exports, "title", {
42
+ Object.defineProperty(exports, "language", {
31
43
  enumerable: true,
32
44
  get: function () {
33
- return _title.default;
45
+ return _language.default;
34
46
  }
35
47
  });
36
- Object.defineProperty(exports, "authors", {
48
+ Object.defineProperty(exports, "melindaId", {
37
49
  enumerable: true,
38
50
  get: function () {
39
- return _authors.default;
51
+ return _melindaId.default;
40
52
  }
41
53
  });
42
- Object.defineProperty(exports, "recordType", {
54
+ Object.defineProperty(exports, "otherStandardIdentifier", {
43
55
  enumerable: true,
44
56
  get: function () {
45
- return _recordType.default;
57
+ return _otherStandardIdentifier.default;
46
58
  }
47
59
  });
48
60
  Object.defineProperty(exports, "publicationTime", {
@@ -51,16 +63,16 @@ Object.defineProperty(exports, "publicationTime", {
51
63
  return _publicationTime.default;
52
64
  }
53
65
  });
54
- Object.defineProperty(exports, "language", {
66
+ Object.defineProperty(exports, "recordType", {
55
67
  enumerable: true,
56
68
  get: function () {
57
- return _language.default;
69
+ return _recordType.default;
58
70
  }
59
71
  });
60
- Object.defineProperty(exports, "bibliographicLevel", {
72
+ Object.defineProperty(exports, "title", {
61
73
  enumerable: true,
62
74
  get: function () {
63
- return _bibliographicLevel.default;
75
+ return _title.default;
64
76
  }
65
77
  });
66
78
 
@@ -84,5 +96,9 @@ var _language = _interopRequireDefault(require("./language"));
84
96
 
85
97
  var _bibliographicLevel = _interopRequireDefault(require("./bibliographic-level"));
86
98
 
99
+ var _melindaId = _interopRequireDefault(require("./melinda-id"));
100
+
101
+ var _allSourceIds = _interopRequireDefault(require("./all-source-ids"));
102
+
87
103
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
88
104
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/match-detection/features/bib/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA","sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Melinda record matching modules for Javascript\n*\n* Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-record-matching-js\n*\n* melinda-record-matching-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-record-matching-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Affero General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nexport {default as hostComponent} from './host-component';\nexport {default as isbn} from './isbn';\nexport {default as issn} from './issn';\nexport {default as otherStandardIdentifier} from './other-standard-identifier';\nexport {default as title} from './title';\nexport {default as authors} from './authors';\nexport {default as recordType} from './record-type';\nexport {default as publicationTime} from './publication-time';\nexport {default as language} from './language';\nexport {default as bibliographicLevel} from './bibliographic-level';\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../../src/match-detection/features/bib/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA","sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Melinda record matching modules for Javascript\n*\n* Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-record-matching-js\n*\n* melinda-record-matching-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-record-matching-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Affero General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nexport {default as hostComponent} from './host-component';\nexport {default as isbn} from './isbn';\nexport {default as issn} from './issn';\nexport {default as otherStandardIdentifier} from './other-standard-identifier';\nexport {default as title} from './title';\nexport {default as authors} from './authors';\nexport {default as recordType} from './record-type';\nexport {default as publicationTime} from './publication-time';\nexport {default as language} from './language';\nexport {default as bibliographicLevel} from './bibliographic-level';\nexport {default as melindaId} from './melinda-id';\nexport {default as allSourceIds} from './all-source-ids';\n"],"file":"index.js"}
@@ -10,9 +10,9 @@ var _marcRecord = require("@natlibfi/marc-record");
10
10
 
11
11
  var features = _interopRequireWildcard(require("."));
12
12
 
13
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
13
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
14
14
 
15
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
16
16
 
17
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
18
 
@@ -43,47 +43,55 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
43
43
  * for the JavaScript code in this file.
44
44
  *
45
45
  */
46
- (0, _fixugen.default)({
47
- path: [__dirname, '..', '..', '..', '..', 'test-fixtures', 'match-detection', 'features', 'bib'],
48
- useMetadataFile: true,
49
- fixura: {
50
- reader: _fixura.READERS.JSON
51
- },
52
- callback: ({
53
- feature,
54
- options,
55
- type,
56
- ...expectations
57
- }) => {
58
- if (type === 'extract') {
59
- const {
60
- expectedFeatures,
61
- inputRecord
62
- } = expectations;
63
- const record = new _marcRecord.MarcRecord(inputRecord, {
64
- subfieldValues: false
65
- });
66
- const {
67
- extract
68
- } = features[feature](options);
69
- (0, _chai.expect)(extract(record)).to.eql(expectedFeatures);
70
- return;
71
- }
46
+ describe('match-detection/features/bib/', () => {
47
+ (0, _fixugen.default)({
48
+ path: [__dirname, '..', '..', '..', '..', 'test-fixtures', 'match-detection', 'features', 'bib'],
49
+ useMetadataFile: true,
50
+ fixura: {
51
+ reader: _fixura.READERS.JSON
52
+ },
53
+ // eslint-disable-next-line max-statements
54
+ callback: ({
55
+ enabled = true,
56
+ feature,
57
+ options,
58
+ type,
59
+ ...expectations
60
+ }) => {
61
+ if (!enabled) {
62
+ return;
63
+ }
72
64
 
73
- if (type === 'compare') {
74
- const {
75
- featuresA,
76
- featuresB,
77
- expectedPoints
78
- } = expectations;
79
- const {
80
- compare
81
- } = features[feature](options);
82
- (0, _chai.expect)(compare(featuresA, featuresB)).to.equal(expectedPoints);
83
- return;
84
- }
65
+ if (type === 'extract') {
66
+ const {
67
+ expectedFeatures,
68
+ inputRecord
69
+ } = expectations;
70
+ const record = new _marcRecord.MarcRecord(inputRecord, {
71
+ subfieldValues: false
72
+ });
73
+ const {
74
+ extract
75
+ } = features[feature](options);
76
+ (0, _chai.expect)(extract(record)).to.eql(expectedFeatures);
77
+ return;
78
+ }
85
79
 
86
- throw new Error(`Invalid type ${type}`);
87
- }
80
+ if (type === 'compare') {
81
+ const {
82
+ featuresA,
83
+ featuresB,
84
+ expectedPoints
85
+ } = expectations;
86
+ const {
87
+ compare
88
+ } = features[feature](options);
89
+ (0, _chai.expect)(compare(featuresA, featuresB)).to.equal(expectedPoints);
90
+ return;
91
+ }
92
+
93
+ throw new Error(`Invalid type ${type}`);
94
+ }
95
+ });
88
96
  });
89
97
  //# sourceMappingURL=index.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/match-detection/features/bib/index.spec.js"],"names":["path","__dirname","useMetadataFile","fixura","reader","READERS","JSON","callback","feature","options","type","expectations","expectedFeatures","inputRecord","record","MarcRecord","subfieldValues","extract","features","to","eql","featuresA","featuresB","expectedPoints","compare","equal","Error"],"mappings":";;AA4BA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAhCA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,sBAAc;AACZA,EAAAA,IAAI,EAAE,CAACC,SAAD,EAAY,IAAZ,EAAkB,IAAlB,EAAwB,IAAxB,EAA8B,IAA9B,EAAoC,eAApC,EAAqD,iBAArD,EAAwE,UAAxE,EAAoF,KAApF,CADM;AAEZC,EAAAA,eAAe,EAAE,IAFL;AAGZC,EAAAA,MAAM,EAAE;AACNC,IAAAA,MAAM,EAAEC,gBAAQC;AADV,GAHI;AAMZC,EAAAA,QAAQ,EAAE,CAAC;AAACC,IAAAA,OAAD;AAAUC,IAAAA,OAAV;AAAmBC,IAAAA,IAAnB;AAAyB,OAAGC;AAA5B,GAAD,KAA+C;AACvD,QAAID,IAAI,KAAK,SAAb,EAAwB;AACtB,YAAM;AAACE,QAAAA,gBAAD;AAAmBC,QAAAA;AAAnB,UAAkCF,YAAxC;AACA,YAAMG,MAAM,GAAG,IAAIC,sBAAJ,CAAeF,WAAf,EAA4B;AAACG,QAAAA,cAAc,EAAE;AAAjB,OAA5B,CAAf;AACA,YAAM;AAACC,QAAAA;AAAD,UAAYC,QAAQ,CAACV,OAAD,CAAR,CAAkBC,OAAlB,CAAlB;AAEA,wBAAOQ,OAAO,CAACH,MAAD,CAAd,EAAwBK,EAAxB,CAA2BC,GAA3B,CAA+BR,gBAA/B;AACA;AACD;;AAED,QAAIF,IAAI,KAAK,SAAb,EAAwB;AACtB,YAAM;AAACW,QAAAA,SAAD;AAAYC,QAAAA,SAAZ;AAAuBC,QAAAA;AAAvB,UAAyCZ,YAA/C;AACA,YAAM;AAACa,QAAAA;AAAD,UAAYN,QAAQ,CAACV,OAAD,CAAR,CAAkBC,OAAlB,CAAlB;AAEA,wBAAOe,OAAO,CAACH,SAAD,EAAYC,SAAZ,CAAd,EAAsCH,EAAtC,CAAyCM,KAAzC,CAA+CF,cAA/C;AACA;AACD;;AAED,UAAM,IAAIG,KAAJ,CAAW,gBAAehB,IAAK,EAA/B,CAAN;AACD;AAzBW,CAAd","sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Melinda record matching modules for Javascript\n*\n* Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-record-matching-js\n*\n* melinda-record-matching-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-record-matching-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Affero General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nimport generateTests from '@natlibfi/fixugen';\nimport {READERS} from '@natlibfi/fixura';\nimport {expect} from 'chai';\nimport {MarcRecord} from '@natlibfi/marc-record';\nimport * as features from '.';\n\ngenerateTests({\n path: [__dirname, '..', '..', '..', '..', 'test-fixtures', 'match-detection', 'features', 'bib'],\n useMetadataFile: true,\n fixura: {\n reader: READERS.JSON\n },\n callback: ({feature, options, type, ...expectations}) => {\n if (type === 'extract') {\n const {expectedFeatures, inputRecord} = expectations;\n const record = new MarcRecord(inputRecord, {subfieldValues: false});\n const {extract} = features[feature](options);\n\n expect(extract(record)).to.eql(expectedFeatures);\n return;\n }\n\n if (type === 'compare') {\n const {featuresA, featuresB, expectedPoints} = expectations;\n const {compare} = features[feature](options);\n\n expect(compare(featuresA, featuresB)).to.equal(expectedPoints);\n return;\n }\n\n throw new Error(`Invalid type ${type}`);\n }\n});\n"],"file":"index.spec.js"}
1
+ {"version":3,"sources":["../../../../src/match-detection/features/bib/index.spec.js"],"names":["describe","path","__dirname","useMetadataFile","fixura","reader","READERS","JSON","callback","enabled","feature","options","type","expectations","expectedFeatures","inputRecord","record","MarcRecord","subfieldValues","extract","features","to","eql","featuresA","featuresB","expectedPoints","compare","equal","Error"],"mappings":";;AA4BA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAhCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AASAA,QAAQ,CAAC,+BAAD,EAAkC,MAAM;AAC9C,wBAAc;AACZC,IAAAA,IAAI,EAAE,CAACC,SAAD,EAAY,IAAZ,EAAkB,IAAlB,EAAwB,IAAxB,EAA8B,IAA9B,EAAoC,eAApC,EAAqD,iBAArD,EAAwE,UAAxE,EAAoF,KAApF,CADM;AAEZC,IAAAA,eAAe,EAAE,IAFL;AAGZC,IAAAA,MAAM,EAAE;AACNC,MAAAA,MAAM,EAAEC,gBAAQC;AADV,KAHI;AAMZ;AACAC,IAAAA,QAAQ,EAAE,CAAC;AAACC,MAAAA,OAAO,GAAG,IAAX;AAAiBC,MAAAA,OAAjB;AAA0BC,MAAAA,OAA1B;AAAmCC,MAAAA,IAAnC;AAAyC,SAAGC;AAA5C,KAAD,KAA+D;AAEvE,UAAI,CAACJ,OAAL,EAAc;AACZ;AACD;;AAED,UAAIG,IAAI,KAAK,SAAb,EAAwB;AACtB,cAAM;AAACE,UAAAA,gBAAD;AAAmBC,UAAAA;AAAnB,YAAkCF,YAAxC;AACA,cAAMG,MAAM,GAAG,IAAIC,sBAAJ,CAAeF,WAAf,EAA4B;AAACG,UAAAA,cAAc,EAAE;AAAjB,SAA5B,CAAf;AACA,cAAM;AAACC,UAAAA;AAAD,YAAYC,QAAQ,CAACV,OAAD,CAAR,CAAkBC,OAAlB,CAAlB;AAEA,0BAAOQ,OAAO,CAACH,MAAD,CAAd,EAAwBK,EAAxB,CAA2BC,GAA3B,CAA+BR,gBAA/B;AACA;AACD;;AAED,UAAIF,IAAI,KAAK,SAAb,EAAwB;AACtB,cAAM;AAACW,UAAAA,SAAD;AAAYC,UAAAA,SAAZ;AAAuBC,UAAAA;AAAvB,YAAyCZ,YAA/C;AACA,cAAM;AAACa,UAAAA;AAAD,YAAYN,QAAQ,CAACV,OAAD,CAAR,CAAkBC,OAAlB,CAAlB;AAEA,0BAAOe,OAAO,CAACH,SAAD,EAAYC,SAAZ,CAAd,EAAsCH,EAAtC,CAAyCM,KAAzC,CAA+CF,cAA/C;AACA;AACD;;AAED,YAAM,IAAIG,KAAJ,CAAW,gBAAehB,IAAK,EAA/B,CAAN;AACD;AA/BW,GAAd;AAiCD,CAlCO,CAAR","sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Melinda record matching modules for Javascript\n*\n* Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-record-matching-js\n*\n* melinda-record-matching-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-record-matching-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Affero General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nimport generateTests from '@natlibfi/fixugen';\nimport {READERS} from '@natlibfi/fixura';\nimport {expect} from 'chai';\nimport {MarcRecord} from '@natlibfi/marc-record';\nimport * as features from '.';\n\n\ndescribe('match-detection/features/bib/', () => {\n generateTests({\n path: [__dirname, '..', '..', '..', '..', 'test-fixtures', 'match-detection', 'features', 'bib'],\n useMetadataFile: true,\n fixura: {\n reader: READERS.JSON\n },\n // eslint-disable-next-line max-statements\n callback: ({enabled = true, feature, options, type, ...expectations}) => {\n\n if (!enabled) {\n return;\n }\n\n if (type === 'extract') {\n const {expectedFeatures, inputRecord} = expectations;\n const record = new MarcRecord(inputRecord, {subfieldValues: false});\n const {extract} = features[feature](options);\n\n expect(extract(record)).to.eql(expectedFeatures);\n return;\n }\n\n if (type === 'compare') {\n const {featuresA, featuresB, expectedPoints} = expectations;\n const {compare} = features[feature](options);\n\n expect(compare(featuresA, featuresB)).to.equal(expectedPoints);\n return;\n }\n\n throw new Error(`Invalid type ${type}`);\n }\n });\n});\n"],"file":"index.spec.js"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/match-detection/features/bib/isbn.js"],"names":["extract","compare","pattern","subfieldCodes","name"],"mappings":";;;;;;;AA4BA;;;;AA5BA;;;;;;;;;;;;;;;;;;;;;;;;;;;eA8Be,MAAM;AACnB,QAAM;AAACA,IAAAA,OAAD;AAAUC,IAAAA;AAAV,MAAqB,wCAAgB;AAACC,IAAAA,OAAO,EAAE,QAAV;AAAoBC,IAAAA,aAAa,EAAE,CAAC,GAAD,EAAM,GAAN;AAAnC,GAAhB,CAA3B;AACA,SAAO;AAACH,IAAAA,OAAD;AAAUC,IAAAA,OAAV;AAAmBG,IAAAA,IAAI,EAAE;AAAzB,GAAP;AACD,C","sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Melinda record matching modules for Javascript\n*\n* Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-record-matching-js\n*\n* melinda-record-matching-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-record-matching-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Affero General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nimport createInterface from './standard-identifier-factory';\n\nexport default () => {\n const {extract, compare} = createInterface({pattern: /^020$/u, subfieldCodes: ['a', 'z']});\n return {extract, compare, name: 'ISBN'};\n};\n"],"file":"isbn.js"}
1
+ {"version":3,"sources":["../../../../src/match-detection/features/bib/isbn.js"],"names":["extract","compare","pattern","subfieldCodes","name"],"mappings":";;;;;;;AA4BA;;;;AA5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;eAIe,MAAM;AACnB,QAAM;AAACA,IAAAA,OAAD;AAAUC,IAAAA;AAAV,MAAqB,wCAAgB;AAACC,IAAAA,OAAO,EAAE,QAAV;AAAoBC,IAAAA,aAAa,EAAE,CAAC,GAAD,EAAM,GAAN;AAAnC,GAAhB,CAA3B;AACA,SAAO;AAACH,IAAAA,OAAD;AAAUC,IAAAA,OAAV;AAAmBG,IAAAA,IAAI,EAAE;AAAzB,GAAP;AACD,C","sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Melinda record matching modules for Javascript\n*\n* Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-record-matching-js\n*\n* melinda-record-matching-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-record-matching-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Affero General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nimport createInterface from './standard-identifier-factory';\n\nexport default () => {\n const {extract, compare} = createInterface({pattern: /^020$/u, subfieldCodes: ['a', 'z']});\n return {extract, compare, name: 'ISBN'};\n};\n"],"file":"isbn.js"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/match-detection/features/bib/issn.js"],"names":["extract","compare","pattern","subfieldCodes","name"],"mappings":";;;;;;;AA4BA;;;;AA5BA;;;;;;;;;;;;;;;;;;;;;;;;;;;eA8Be,MAAM;AACnB,QAAM;AAACA,IAAAA,OAAD;AAAUC,IAAAA;AAAV,MAAqB,wCAAgB;AAACC,IAAAA,OAAO,EAAE,QAAV;AAAoBC,IAAAA,aAAa,EAAE,CAAC,GAAD,EAAM,GAAN,EAAW,GAAX;AAAnC,GAAhB,CAA3B;AACA,SAAO;AAACH,IAAAA,OAAD;AAAUC,IAAAA,OAAV;AAAmBG,IAAAA,IAAI,EAAE;AAAzB,GAAP;AACD,C","sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Melinda record matching modules for Javascript\n*\n* Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-record-matching-js\n*\n* melinda-record-matching-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-record-matching-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Affero General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nimport createInterface from './standard-identifier-factory';\n\nexport default () => {\n const {extract, compare} = createInterface({pattern: /^022$/u, subfieldCodes: ['a', 'z', 'y']});\n return {extract, compare, name: 'ISSN'};\n};\n"],"file":"issn.js"}
1
+ {"version":3,"sources":["../../../../src/match-detection/features/bib/issn.js"],"names":["extract","compare","pattern","subfieldCodes","name"],"mappings":";;;;;;;AA4BA;;;;AA5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;eAIe,MAAM;AACnB,QAAM;AAACA,IAAAA,OAAD;AAAUC,IAAAA;AAAV,MAAqB,wCAAgB;AAACC,IAAAA,OAAO,EAAE,QAAV;AAAoBC,IAAAA,aAAa,EAAE,CAAC,GAAD,EAAM,GAAN,EAAW,GAAX;AAAnC,GAAhB,CAA3B;AACA,SAAO;AAACH,IAAAA,OAAD;AAAUC,IAAAA,OAAV;AAAmBG,IAAAA,IAAI,EAAE;AAAzB,GAAP;AACD,C","sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Melinda record matching modules for Javascript\n*\n* Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-record-matching-js\n*\n* melinda-record-matching-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-record-matching-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Affero General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nimport createInterface from './standard-identifier-factory';\n\nexport default () => {\n const {extract, compare} = createInterface({pattern: /^022$/u, subfieldCodes: ['a', 'z', 'y']});\n return {extract, compare, name: 'ISSN'};\n};\n"],"file":"issn.js"}
@@ -5,6 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
+ var _debug = _interopRequireDefault(require("debug"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ /* eslint-disable max-statements */
13
+
8
14
  /**
9
15
  *
10
16
  * @licstart The following is the entire license notice for the JavaScript code in this file.
@@ -32,38 +38,69 @@ exports.default = void 0;
32
38
  * for the JavaScript code in this file.
33
39
  *
34
40
  */
41
+ const debug = (0, _debug.default)('@natlibfi/melinda-record-matching:match-detection:features:language');
42
+ const debugData = debug.extend('data');
43
+
35
44
  var _default = () => ({
36
45
  name: 'Language',
37
46
  extract: record => {
38
47
  const value008 = get008Value();
39
48
  const values041 = get041Values();
49
+ debugData(`008: ${JSON.stringify(value008)}, 041: ${JSON.stringify(values041)}`);
40
50
 
41
51
  if (value008 && values041.length > 0) {
52
+ debugData(`There's both 008 and 041, searching for value in both`);
42
53
  const correspondingValue = values041.find(v => v === value008);
54
+ debugData(`Corresponding value: ${correspondingValue}`);
43
55
  return correspondingValue ? [correspondingValue] : [];
44
56
  }
45
57
 
58
+ if (!value008 && values041.length < 1) {
59
+ debugData(`No actual values found`);
60
+ return [];
61
+ }
62
+
46
63
  return value008 ? [value008] : [values041[0]];
47
64
 
48
65
  function get008Value() {
49
66
  var _record$get, _record$get$;
50
67
 
51
- const value = ((_record$get = record.get(/^008$/u)) === null || _record$get === void 0 ? void 0 : (_record$get$ = _record$get[0]) === null || _record$get$ === void 0 ? void 0 : _record$get$.value) || [];
68
+ const value = ((_record$get = record.get(/^008$/u)) === null || _record$get === void 0 ? void 0 : (_record$get$ = _record$get[0]) === null || _record$get$ === void 0 ? void 0 : _record$get$.value) || undefined;
69
+ debugData(`008 value: ${value}`);
70
+
71
+ if (!value) {
72
+ return undefined;
73
+ }
74
+
52
75
  const code = value.slice(35, 38);
53
- return code === '|||' ? undefined : code;
54
- }
76
+ debugData(`008 code: ${code}`);
77
+ return code === '|||' || code === ' ' || code === '^^^' ? undefined : code;
78
+ } // Main language for the resource: in the first f041 $a or f041 $d
79
+ // Uses only f041s that have 2nd ind ' ', which means that the codes used are MARC 21 language codes
80
+
55
81
 
56
82
  function get041Values() {
57
- return record.get(/^041$/u).map(({
83
+ return record.get(/^041$/u).filter(({
84
+ ind2
85
+ }) => ind2 === ' ').map(({
58
86
  subfields
59
87
  }) => subfields).flat().filter(({
60
88
  code
61
- }) => code === 'a').map(({
89
+ }) => code === 'a' || code === 'd').map(({
62
90
  value
63
91
  }) => value);
64
92
  }
65
93
  },
66
94
  compare: (a, b) => {
95
+ debugData(`Comparing ${JSON.stringify(a[0])} and ${JSON.stringify(b[0])}`);
96
+
97
+ if (a.length === 0 || b.length === 0) {
98
+ debugData(`No language to compare`);
99
+ return 0;
100
+ }
101
+
102
+ debugData(`There area languages to compare`);
103
+
67
104
  if (a[0] === b[0]) {
68
105
  return 0.1;
69
106
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/match-detection/features/bib/language.js"],"names":["name","extract","record","value008","get008Value","values041","get041Values","length","correspondingValue","find","v","value","get","code","slice","undefined","map","subfields","flat","filter","compare","a","b"],"mappings":";;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;eA4Be,OAAO;AACpBA,EAAAA,IAAI,EAAE,UADc;AAEpBC,EAAAA,OAAO,EAAEC,MAAM,IAAI;AACjB,UAAMC,QAAQ,GAAGC,WAAW,EAA5B;AACA,UAAMC,SAAS,GAAGC,YAAY,EAA9B;;AAEA,QAAIH,QAAQ,IAAIE,SAAS,CAACE,MAAV,GAAmB,CAAnC,EAAsC;AACpC,YAAMC,kBAAkB,GAAGH,SAAS,CAACI,IAAV,CAAeC,CAAC,IAAIA,CAAC,KAAKP,QAA1B,CAA3B;AACA,aAAOK,kBAAkB,GAAG,CAACA,kBAAD,CAAH,GAA0B,EAAnD;AACD;;AAED,WAAOL,QAAQ,GAAG,CAACA,QAAD,CAAH,GAAgB,CAACE,SAAS,CAAC,CAAD,CAAV,CAA/B;;AAEA,aAASD,WAAT,GAAuB;AAAA;;AACrB,YAAMO,KAAK,GAAG,gBAAAT,MAAM,CAACU,GAAP,CAAW,QAAX,6EAAuB,CAAvB,+DAA2BD,KAA3B,KAAoC,EAAlD;AACA,YAAME,IAAI,GAAGF,KAAK,CAACG,KAAN,CAAY,EAAZ,EAAgB,EAAhB,CAAb;AACA,aAAOD,IAAI,KAAK,KAAT,GAAiBE,SAAjB,GAA6BF,IAApC;AACD;;AAED,aAASP,YAAT,GAAwB;AACtB,aAAOJ,MAAM,CAACU,GAAP,CAAW,QAAX,EACJI,GADI,CACA,CAAC;AAACC,QAAAA;AAAD,OAAD,KAAiBA,SADjB,EAEJC,IAFI,GAGJC,MAHI,CAGG,CAAC;AAACN,QAAAA;AAAD,OAAD,KAAYA,IAAI,KAAK,GAHxB,EAIJG,GAJI,CAIA,CAAC;AAACL,QAAAA;AAAD,OAAD,KAAaA,KAJb,CAAP;AAKD;AACF,GA1BmB;AA2BpBS,EAAAA,OAAO,EAAE,CAACC,CAAD,EAAIC,CAAJ,KAAU;AACjB,QAAID,CAAC,CAAC,CAAD,CAAD,KAASC,CAAC,CAAC,CAAD,CAAd,EAAmB;AACjB,aAAO,GAAP;AACD;;AAED,WAAOD,CAAC,CAAC,CAAD,CAAD,KAAS,KAAT,IAAkBC,CAAC,CAAC,CAAD,CAAD,KAAS,KAA3B,GAAmC,GAAnC,GAAyC,CAAC,GAAjD;AACD;AAjCmB,CAAP,C","sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Melinda record matching modules for Javascript\n*\n* Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-record-matching-js\n*\n* melinda-record-matching-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-record-matching-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Affero General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nexport default () => ({\n name: 'Language',\n extract: record => {\n const value008 = get008Value();\n const values041 = get041Values();\n\n if (value008 && values041.length > 0) {\n const correspondingValue = values041.find(v => v === value008);\n return correspondingValue ? [correspondingValue] : [];\n }\n\n return value008 ? [value008] : [values041[0]];\n\n function get008Value() {\n const value = record.get(/^008$/u)?.[0]?.value || [];\n const code = value.slice(35, 38);\n return code === '|||' ? undefined : code;\n }\n\n function get041Values() {\n return record.get(/^041$/u)\n .map(({subfields}) => subfields)\n .flat()\n .filter(({code}) => code === 'a')\n .map(({value}) => value);\n }\n },\n compare: (a, b) => {\n if (a[0] === b[0]) {\n return 0.1;\n }\n\n return a[0] === 'und' || b[0] === 'und' ? 0.0 : -1.0;\n }\n});\n"],"file":"language.js"}
1
+ {"version":3,"sources":["../../../../src/match-detection/features/bib/language.js"],"names":["debug","debugData","extend","name","extract","record","value008","get008Value","values041","get041Values","JSON","stringify","length","correspondingValue","find","v","value","get","undefined","code","slice","filter","ind2","map","subfields","flat","compare","a","b"],"mappings":"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","sourcesContent":["/* eslint-disable max-statements */\n/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Melinda record matching modules for Javascript\n*\n* Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-record-matching-js\n*\n* melinda-record-matching-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-record-matching-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Affero General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nimport createDebugLogger from 'debug';\n\nconst debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features:language');\nconst debugData = debug.extend('data');\n\nexport default () => ({\n name: 'Language',\n extract: record => {\n const value008 = get008Value();\n const values041 = get041Values();\n debugData(`008: ${JSON.stringify(value008)}, 041: ${JSON.stringify(values041)}`);\n\n if (value008 && values041.length > 0) {\n debugData(`There's both 008 and 041, searching for value in both`);\n const correspondingValue = values041.find(v => v === value008);\n debugData(`Corresponding value: ${correspondingValue}`);\n return correspondingValue ? [correspondingValue] : [];\n }\n\n if (!value008 && values041.length < 1) {\n debugData(`No actual values found`);\n return [];\n }\n\n return value008 ? [value008] : [values041[0]];\n\n function get008Value() {\n const value = record.get(/^008$/u)?.[0]?.value || undefined;\n debugData(`008 value: ${value}`);\n\n if (!value) {\n return undefined;\n }\n\n const code = value.slice(35, 38);\n debugData(`008 code: ${code}`);\n return code === '|||' || code === ' ' || code === '^^^' ? undefined : code;\n }\n\n // Main language for the resource: in the first f041 $a or f041 $d\n // Uses only f041s that have 2nd ind ' ', which means that the codes used are MARC 21 language codes\n\n function get041Values() {\n return record.get(/^041$/u)\n .filter(({ind2}) => ind2 === ' ')\n .map(({subfields}) => subfields)\n .flat()\n .filter(({code}) => code === 'a' || code === 'd')\n .map(({value}) => value);\n }\n },\n compare: (a, b) => {\n debugData(`Comparing ${JSON.stringify(a[0])} and ${JSON.stringify(b[0])}`);\n\n if (a.length === 0 || b.length === 0) {\n debugData(`No language to compare`);\n return 0;\n }\n\n debugData(`There area languages to compare`);\n\n if (a[0] === b[0]) {\n return 0.1;\n }\n\n return a[0] === 'und' || b[0] === 'und' ? 0.0 : -1.0;\n }\n});\n"],"file":"language.js"}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _melindaIdentifierFactory = _interopRequireDefault(require("./melinda-identifier-factory"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ /**
13
+ *
14
+ * @licstart The following is the entire license notice for the JavaScript code in this file.
15
+ *
16
+ * Melinda record matching modules for Javascript
17
+ *
18
+ * Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)
19
+ *
20
+ * This file is part of melinda-record-matching-js
21
+ *
22
+ * melinda-record-matching-js program is free software: you can redistribute it and/or modify
23
+ * it under the terms of the GNU Lesser General Public License as
24
+ * published by the Free Software Foundation, either version 3 of the
25
+ * License, or (at your option) any later version.
26
+ *
27
+ * melinda-record-matching-js is distributed in the hope that it will be useful,
28
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
29
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30
+ * GNU Lesser General Public License for more details.
31
+ *
32
+ * You should have received a copy of the GNU Affero General Public License
33
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
34
+ *
35
+ * @licend The above is the entire license notice
36
+ * for the JavaScript code in this file.
37
+ *
38
+ */
39
+ var _default = () => {
40
+ const {
41
+ extract,
42
+ compare
43
+ } = (0, _melindaIdentifierFactory.default)();
44
+ return {
45
+ extract,
46
+ compare,
47
+ name: 'melinda-id'
48
+ };
49
+ };
50
+
51
+ exports.default = _default;
52
+ //# sourceMappingURL=melinda-id.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/match-detection/features/bib/melinda-id.js"],"names":["extract","compare","name"],"mappings":";;;;;;;AA4BA;;;;AA5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;eAIe,MAAM;AACnB,QAAM;AAACA,IAAAA,OAAD;AAAUC,IAAAA;AAAV,MAAqB,wCAA3B;AACA,SAAO;AAACD,IAAAA,OAAD;AAAUC,IAAAA,OAAV;AAAmBC,IAAAA,IAAI,EAAE;AAAzB,GAAP;AACD,C","sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Melinda record matching modules for Javascript\n*\n* Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-record-matching-js\n*\n* melinda-record-matching-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-record-matching-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Affero General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nimport createInterface from './melinda-identifier-factory';\n\nexport default () => {\n const {extract, compare} = createInterface();\n return {extract, compare, name: 'melinda-id'};\n};\n"],"file":"melinda-id.js"}
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _debug = _interopRequireDefault(require("debug"));
9
+
10
+ var _matchingUtils = require("../../../matching-utils");
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ /**
15
+ *
16
+ * @licstart The following is the entire license notice for the JavaScript code in this file.
17
+ *
18
+ * Melinda record matching modules for Javascript
19
+ *
20
+ * Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)
21
+ *
22
+ * This file is part of melinda-record-matching-js
23
+ *
24
+ * melinda-record-matching-js program is free software: you can redistribute it and/or modify
25
+ * it under the terms of the GNU Lesser General Public License as
26
+ * published by the Free Software Foundation, either version 3 of the
27
+ * License, or (at your option) any later version.
28
+ *
29
+ * melinda-record-matching-js is distributed in the hope that it will be useful,
30
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
31
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32
+ * GNU Lesser General Public License for more details.
33
+ *
34
+ * You should have received a copy of the GNU Affero General Public License
35
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
36
+ *
37
+ * @licend The above is the entire license notice
38
+ * for the JavaScript code in this file.
39
+ *
40
+ */
41
+ // 003+001 FI-MELINDA <melinda-id>
42
+ // 035 $a (FI-MELINDA)<melinda-id>
43
+ // 035 $z (FI-MELINDA)<melinda-id>
44
+ // 035 $a FCC<melinda-id>
45
+ // 035 $z FCC<melinda-id>
46
+ // melinda-id = 001234567
47
+ var _default = () => {
48
+ const debug = (0, _debug.default)('@natlibfi/melinda-record-matching:match-detection:features/bib/melinda-id');
49
+ const debugData = debug.extend('data');
50
+ return {
51
+ extract,
52
+ compare
53
+ };
54
+
55
+ function extract(record) {
56
+ const isMelindaRecord = record.get('003').some(f003 => f003.value === 'FI-MELINDA');
57
+ const [f001] = record.get('001').map(field => field.value);
58
+ const f035MelindaIds = (0, _matchingUtils.getMelindaIdsF035)(record);
59
+
60
+ if (isMelindaRecord === undefined && f001 === undefined && f035MelindaIds.length < 1) {
61
+ debug(`No Melinda-IDs found`);
62
+ return {};
63
+ }
64
+
65
+ return {
66
+ isMelindaRecord,
67
+ f001,
68
+ f035MelindaIds
69
+ };
70
+ } // eslint-disable-next-line max-statements
71
+
72
+
73
+ function compare(a, b) {
74
+ if (a.isMelindaRecord && b.isMelindaRecord && a.f001 === b.f001) {
75
+ debugData(`Melinda record's A f001 ${a.f001} matches Melinda record's B f001 ${a.f001}`);
76
+ return 1;
77
+ }
78
+
79
+ if (a.isMelindaRecord && typeof b.f035MelindaIds !== 'undefined' && b.f035MelindaIds.some(id => id === a.f001)) {
80
+ debugData(`Melinda record's A f001 ${a.f001} matches record B f035 ${JSON.stringify(b.f035MelindaIds)}`);
81
+ return 1;
82
+ }
83
+
84
+ if (b.isMelindaRecord && typeof a.f035MelindaIds !== 'undefined' && a.f035MelindaIds.some(id => id === b.f001)) {
85
+ debugData(`Melinda record's B f001 ${b.f001} matches record A f035 ${JSON.stringify(a.f035MelindaIds)}`);
86
+ return 1;
87
+ }
88
+
89
+ if (typeof a.f035MelindaIds !== 'undefined' && typeof b.f035MelindaIds !== 'undefined' && a.f035MelindaIds.some(idA => b.f035MelindaIds.some(idB => idB === idA))) {
90
+ debugData(`Record A f035 ${JSON.stringify(a.f035MelindaIds)} matches record B f035 ${JSON.stringify(b.f035MelindaIds)}`);
91
+ return 1;
92
+ }
93
+
94
+ debug(`No matching Melinda-IDs.`);
95
+ return 0;
96
+ }
97
+ };
98
+
99
+ exports.default = _default;
100
+ //# sourceMappingURL=melinda-identifier-factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/match-detection/features/bib/melinda-identifier-factory.js"],"names":["debug","debugData","extend","extract","compare","record","isMelindaRecord","get","some","f003","value","f001","map","field","f035MelindaIds","undefined","length","a","b","id","JSON","stringify","idA","idB"],"mappings":"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","sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Melinda record matching modules for Javascript\n*\n* Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-record-matching-js\n*\n* melinda-record-matching-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-record-matching-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Affero General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nimport createDebugLogger from 'debug';\nimport {getMelindaIdsF035} from '../../../matching-utils';\n\n// 003+001 FI-MELINDA <melinda-id>\n// 035 $a (FI-MELINDA)<melinda-id>\n// 035 $z (FI-MELINDA)<melinda-id>\n// 035 $a FCC<melinda-id>\n// 035 $z FCC<melinda-id>\n// melinda-id = 001234567\n\nexport default () => {\n\n const debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features/bib/melinda-id');\n const debugData = debug.extend('data');\n\n return {extract, compare};\n\n function extract(record) {\n\n const isMelindaRecord = record.get('003').some(f003 => f003.value === 'FI-MELINDA');\n const [f001] = record.get('001').map(field => field.value);\n const f035MelindaIds = getMelindaIdsF035(record);\n\n if (\n isMelindaRecord === undefined &&\n f001 === undefined &&\n f035MelindaIds.length < 1) {\n\n debug(`No Melinda-IDs found`);\n return {};\n }\n\n return {isMelindaRecord, f001, f035MelindaIds};\n\n }\n\n // eslint-disable-next-line max-statements\n function compare(a, b) {\n\n if (a.isMelindaRecord && b.isMelindaRecord &&\n a.f001 === b.f001) {\n debugData(`Melinda record's A f001 ${a.f001} matches Melinda record's B f001 ${a.f001}`);\n return 1;\n }\n\n if (a.isMelindaRecord && typeof b.f035MelindaIds !== 'undefined' &&\n b.f035MelindaIds.some(id => id === a.f001)) {\n debugData(`Melinda record's A f001 ${a.f001} matches record B f035 ${JSON.stringify(b.f035MelindaIds)}`);\n return 1;\n }\n\n if (b.isMelindaRecord && typeof a.f035MelindaIds !== 'undefined' &&\n a.f035MelindaIds.some(id => id === b.f001)) {\n debugData(`Melinda record's B f001 ${b.f001} matches record A f035 ${JSON.stringify(a.f035MelindaIds)}`);\n return 1;\n }\n\n if (typeof a.f035MelindaIds !== 'undefined' && typeof b.f035MelindaIds !== 'undefined' &&\n a.f035MelindaIds.some(idA => b.f035MelindaIds.some(idB => idB === idA))) {\n debugData(`Record A f035 ${JSON.stringify(a.f035MelindaIds)} matches record B f035 ${JSON.stringify(b.f035MelindaIds)}`);\n return 1;\n }\n debug(`No matching Melinda-IDs.`);\n return 0;\n }\n};\n"],"file":"melinda-identifier-factory.js"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/match-detection/features/bib/other-standard-identifier.js"],"names":["extract","compare","pattern","subfieldCodes","name"],"mappings":";;;;;;;AA4BA;;;;AA5BA;;;;;;;;;;;;;;;;;;;;;;;;;;;eA8Be,MAAM;AACnB,QAAM;AAACA,IAAAA,OAAD;AAAUC,IAAAA;AAAV,MAAqB,wCAAgB;AAACC,IAAAA,OAAO,EAAE,QAAV;AAAoBC,IAAAA,aAAa,EAAE,CAAC,GAAD,EAAM,GAAN;AAAnC,GAAhB,CAA3B;AACA,SAAO;AAACH,IAAAA,OAAD;AAAUC,IAAAA,OAAV;AAAmBG,IAAAA,IAAI,EAAE;AAAzB,GAAP;AACD,C","sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Melinda record matching modules for Javascript\n*\n* Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-record-matching-js\n*\n* melinda-record-matching-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-record-matching-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Affero General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nimport createInterface from './standard-identifier-factory';\n\nexport default () => {\n const {extract, compare} = createInterface({pattern: /^024$/u, subfieldCodes: ['a', 'z']});\n return {extract, compare, name: 'Other standard identifier'};\n};\n"],"file":"other-standard-identifier.js"}
1
+ {"version":3,"sources":["../../../../src/match-detection/features/bib/other-standard-identifier.js"],"names":["extract","compare","pattern","subfieldCodes","name"],"mappings":";;;;;;;AA4BA;;;;AA5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;eAIe,MAAM;AACnB,QAAM;AAACA,IAAAA,OAAD;AAAUC,IAAAA;AAAV,MAAqB,wCAAgB;AAACC,IAAAA,OAAO,EAAE,QAAV;AAAoBC,IAAAA,aAAa,EAAE,CAAC,GAAD,EAAM,GAAN;AAAnC,GAAhB,CAA3B;AACA,SAAO;AAACH,IAAAA,OAAD;AAAUC,IAAAA,OAAV;AAAmBG,IAAAA,IAAI,EAAE;AAAzB,GAAP;AACD,C","sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Melinda record matching modules for Javascript\n*\n* Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-record-matching-js\n*\n* melinda-record-matching-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-record-matching-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Affero General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nimport createInterface from './standard-identifier-factory';\n\nexport default () => {\n const {extract, compare} = createInterface({pattern: /^024$/u, subfieldCodes: ['a', 'z']});\n return {extract, compare, name: 'Other standard identifier'};\n};\n"],"file":"other-standard-identifier.js"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/match-detection/features/bib/publication-time.js"],"names":["name","extract","record","value","get","slice","compare","a","b"],"mappings":";;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;eA4Be,OAAO;AACpBA,EAAAA,IAAI,EAAE,kBADc;AAEpBC,EAAAA,OAAO,EAAEC,MAAM,IAAI;AAAA;;AACjB,UAAMC,KAAK,GAAG,gBAAAD,MAAM,CAACE,GAAP,CAAW,QAAX,6EAAuB,CAAvB,+DAA2BD,KAA3B,KAAoC,EAAlD;AACA,WAAOA,KAAK,GAAG,CAACA,KAAK,CAACE,KAAN,CAAY,CAAZ,EAAe,EAAf,CAAD,CAAH,GAA0B,EAAtC;AACD,GALmB;AAMpBC,EAAAA,OAAO,EAAE,CAACC,CAAD,EAAIC,CAAJ,KAAUD,CAAC,CAAC,CAAD,CAAD,KAASC,CAAC,CAAC,CAAD,CAAV,GAAgB,GAAhB,GAAsB,CAAC;AANtB,CAAP,C","sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Melinda record matching modules for Javascript\n*\n* Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-record-matching-js\n*\n* melinda-record-matching-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-record-matching-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Affero General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nexport default () => ({\n name: 'Publication time',\n extract: record => {\n const value = record.get(/^008$/u)?.[0]?.value || '';\n return value ? [value.slice(7, 11)] : [];\n },\n compare: (a, b) => a[0] === b[0] ? 0.1 : -1.0\n});\n"],"file":"publication-time.js"}
1
+ {"version":3,"sources":["../../../../src/match-detection/features/bib/publication-time.js"],"names":["name","extract","record","value","get","slice","compare","a","b"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;eAEe,OAAO;AACpBA,EAAAA,IAAI,EAAE,kBADc;AAEpBC,EAAAA,OAAO,EAAEC,MAAM,IAAI;AAAA;;AACjB,UAAMC,KAAK,GAAG,gBAAAD,MAAM,CAACE,GAAP,CAAW,QAAX,6EAAuB,CAAvB,+DAA2BD,KAA3B,KAAoC,EAAlD;AACA,WAAOA,KAAK,GAAG,CAACA,KAAK,CAACE,KAAN,CAAY,CAAZ,EAAe,EAAf,CAAD,CAAH,GAA0B,EAAtC;AACD,GALmB;AAMpBC,EAAAA,OAAO,EAAE,CAACC,CAAD,EAAIC,CAAJ,KAAUD,CAAC,CAAC,CAAD,CAAD,KAASC,CAAC,CAAC,CAAD,CAAV,GAAgB,GAAhB,GAAsB,CAAC;AANtB,CAAP,C","sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Melinda record matching modules for Javascript\n*\n* Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-record-matching-js\n*\n* melinda-record-matching-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-record-matching-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Affero General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nexport default () => ({\n name: 'Publication time',\n extract: record => {\n const value = record.get(/^008$/u)?.[0]?.value || '';\n return value ? [value.slice(7, 11)] : [];\n },\n compare: (a, b) => a[0] === b[0] ? 0.1 : -1.0\n});\n"],"file":"publication-time.js"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/match-detection/features/bib/record-type.js"],"names":["name","extract","r","leader","compare","a","b"],"mappings":";;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;eA4Be,OAAO;AACpBA,EAAAA,IAAI,EAAE,aADc;AAEpBC,EAAAA,OAAO,EAAEC,CAAC,IAAIA,CAAC,CAACC,MAAF,CAAS,CAAT,IAAc,CAACD,CAAC,CAACC,MAAF,CAAS,CAAT,CAAD,CAAd,GAA8B,EAFxB;AAGpBC,EAAAA,OAAO,EAAE,CAACC,CAAD,EAAIC,CAAJ,KAAUD,CAAC,CAAC,CAAD,CAAD,KAASC,CAAC,CAAC,CAAD,CAAV,GAAgB,GAAhB,GAAsB,CAAC;AAHtB,CAAP,C","sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Melinda record matching modules for Javascript\n*\n* Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-record-matching-js\n*\n* melinda-record-matching-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-record-matching-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Affero General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nexport default () => ({\n name: 'Record type',\n extract: r => r.leader[6] ? [r.leader[6]] : [],\n compare: (a, b) => a[0] === b[0] ? 0.1 : -0.5\n});\n"],"file":"record-type.js"}
1
+ {"version":3,"sources":["../../../../src/match-detection/features/bib/record-type.js"],"names":["name","extract","r","leader","compare","a","b"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;eAEe,OAAO;AACpBA,EAAAA,IAAI,EAAE,aADc;AAEpBC,EAAAA,OAAO,EAAEC,CAAC,IAAIA,CAAC,CAACC,MAAF,CAAS,CAAT,IAAc,CAACD,CAAC,CAACC,MAAF,CAAS,CAAT,CAAD,CAAd,GAA8B,EAFxB;AAGpBC,EAAAA,OAAO,EAAE,CAACC,CAAD,EAAIC,CAAJ,KAAUD,CAAC,CAAC,CAAD,CAAD,KAASC,CAAC,CAAC,CAAD,CAAV,GAAgB,GAAhB,GAAsB,CAAC;AAHtB,CAAP,C","sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Melinda record matching modules for Javascript\n*\n* Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-record-matching-js\n*\n* melinda-record-matching-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-record-matching-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Affero General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nexport default () => ({\n name: 'Record type',\n extract: r => r.leader[6] ? [r.leader[6]] : [],\n compare: (a, b) => a[0] === b[0] ? 0.1 : -0.5\n});\n"],"file":"record-type.js"}
@@ -5,6 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
+ var _debug = _interopRequireDefault(require("debug"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
8
12
  /**
9
13
  *
10
14
  * @licstart The following is the entire license notice for the JavaScript code in this file.
@@ -32,6 +36,9 @@ exports.default = void 0;
32
36
  * for the JavaScript code in this file.
33
37
  *
34
38
  */
39
+ const debug = (0, _debug.default)('@natlibfi/melinda-record-matching:match-detection:features:standard-identifiers');
40
+ const debugData = debug.extend('data');
41
+
35
42
  var _default = ({
36
43
  pattern,
37
44
  subfieldCodes
@@ -61,6 +68,7 @@ var _default = ({
61
68
 
62
69
  function compare(a, b) {
63
70
  if (a.length === 0 || b.length === 0) {
71
+ debugData(`No standardidentifiers to compare`);
64
72
  return 0;
65
73
  }
66
74