@natlibfi/melinda-record-matching 2.2.1-alpha.1 → 2.2.1-alpha.3

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 (66) hide show
  1. package/dist/candidate-search/candidate-search-utils.js +55 -0
  2. package/dist/candidate-search/candidate-search-utils.js.map +1 -0
  3. package/dist/candidate-search/index.js +258 -0
  4. package/dist/candidate-search/index.js.map +1 -0
  5. package/dist/candidate-search/index.spec.js +148 -0
  6. package/dist/candidate-search/index.spec.js.map +1 -0
  7. package/dist/candidate-search/query-list/bib.js +230 -0
  8. package/dist/candidate-search/query-list/bib.js.map +1 -0
  9. package/dist/candidate-search/query-list/bib.spec.js +63 -0
  10. package/dist/candidate-search/query-list/bib.spec.js.map +1 -0
  11. package/dist/candidate-search/query-list/index.js +61 -0
  12. package/dist/candidate-search/query-list/index.js.map +1 -0
  13. package/dist/index.js +559 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/index.spec.js +125 -0
  16. package/dist/index.spec.js.map +1 -0
  17. package/dist/match-detection/features/bib/all-source-ids.js +116 -0
  18. package/dist/match-detection/features/bib/all-source-ids.js.map +1 -0
  19. package/dist/match-detection/features/bib/authors.js +107 -0
  20. package/dist/match-detection/features/bib/authors.js.map +1 -0
  21. package/dist/match-detection/features/bib/bibliographic-level.js +39 -0
  22. package/dist/match-detection/features/bib/bibliographic-level.js.map +1 -0
  23. package/dist/match-detection/features/bib/host-component.js +39 -0
  24. package/dist/match-detection/features/bib/host-component.js.map +1 -0
  25. package/dist/match-detection/features/bib/index.js +91 -0
  26. package/dist/match-detection/features/bib/index.js.map +1 -0
  27. package/dist/match-detection/features/bib/index.spec.js +87 -0
  28. package/dist/match-detection/features/bib/index.spec.js.map +1 -0
  29. package/dist/match-detection/features/bib/isbn.js +50 -0
  30. package/dist/match-detection/features/bib/isbn.js.map +1 -0
  31. package/dist/match-detection/features/bib/issn.js +50 -0
  32. package/dist/match-detection/features/bib/issn.js.map +1 -0
  33. package/dist/match-detection/features/bib/language.js +98 -0
  34. package/dist/match-detection/features/bib/language.js.map +1 -0
  35. package/dist/match-detection/features/bib/melinda-id.js +47 -0
  36. package/dist/match-detection/features/bib/melinda-id.js.map +1 -0
  37. package/dist/match-detection/features/bib/melinda-identifier-factory.js +88 -0
  38. package/dist/match-detection/features/bib/melinda-identifier-factory.js.map +1 -0
  39. package/dist/match-detection/features/bib/other-standard-identifier.js +50 -0
  40. package/dist/match-detection/features/bib/other-standard-identifier.js.map +1 -0
  41. package/dist/match-detection/features/bib/publication-time.js +47 -0
  42. package/dist/match-detection/features/bib/publication-time.js.map +1 -0
  43. package/dist/match-detection/features/bib/record-type.js +41 -0
  44. package/dist/match-detection/features/bib/record-type.js.map +1 -0
  45. package/dist/match-detection/features/bib/standard-identifier-factory.js +112 -0
  46. package/dist/match-detection/features/bib/standard-identifier-factory.js.map +1 -0
  47. package/dist/match-detection/features/bib/title.js +78 -0
  48. package/dist/match-detection/features/bib/title.js.map +1 -0
  49. package/dist/match-detection/features/index.js +11 -0
  50. package/dist/match-detection/features/index.js.map +1 -0
  51. package/dist/match-detection/index.js +162 -0
  52. package/dist/match-detection/index.js.map +1 -0
  53. package/dist/match-detection/index.spec.js +88 -0
  54. package/dist/match-detection/index.spec.js.map +1 -0
  55. package/dist/matching-utils.js +95 -0
  56. package/dist/matching-utils.js.map +1 -0
  57. package/package.json +18 -17
  58. package/src/candidate-search/query-list/bib.js +19 -18
  59. package/src/candidate-search/query-list/index.js +1 -1
  60. package/src/match-detection/features/bib/authors.js +5 -2
  61. package/src/match-detection/features/bib/language.js +2 -2
  62. package/src/match-detection/features/bib/publication-time.js +8 -3
  63. package/src/match-detection/features/bib/record-type.js +2 -0
  64. package/src/match-detection/features/bib/standard-identifier-factory.js +4 -3
  65. package/src/match-detection/features/bib/title.js +6 -4
  66. package/src/matching-utils.js +13 -4
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+
3
+ var _fixugen = _interopRequireDefault(require("@natlibfi/fixugen"));
4
+ var _fixura = require("@natlibfi/fixura");
5
+ var _chai = require("chai");
6
+ var _marcRecord = require("@natlibfi/marc-record");
7
+ var features = _interopRequireWildcard(require("."));
8
+ 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); }
9
+ 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; }
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+ /**
12
+ *
13
+ * @licstart The following is the entire license notice for the JavaScript code in this file.
14
+ *
15
+ * Melinda record matching modules for Javascript
16
+ *
17
+ * Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)
18
+ *
19
+ * This file is part of melinda-record-matching-js
20
+ *
21
+ * melinda-record-matching-js program is free software: you can redistribute it and/or modify
22
+ * it under the terms of the GNU Lesser General Public License as
23
+ * published by the Free Software Foundation, either version 3 of the
24
+ * License, or (at your option) any later version.
25
+ *
26
+ * melinda-record-matching-js is distributed in the hope that it will be useful,
27
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
28
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29
+ * GNU Lesser General Public License for more details.
30
+ *
31
+ * You should have received a copy of the GNU Affero General Public License
32
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
33
+ *
34
+ * @licend The above is the entire license notice
35
+ * for the JavaScript code in this file.
36
+ *
37
+ */
38
+
39
+ describe('match-detection/features/bib/', () => {
40
+ (0, _fixugen.default)({
41
+ path: [__dirname, '..', '..', '..', '..', 'test-fixtures', 'match-detection', 'features', 'bib'],
42
+ useMetadataFile: true,
43
+ fixura: {
44
+ reader: _fixura.READERS.JSON
45
+ },
46
+ // eslint-disable-next-line max-statements
47
+ callback: ({
48
+ enabled = true,
49
+ feature,
50
+ options,
51
+ type,
52
+ ...expectations
53
+ }) => {
54
+ if (!enabled) {
55
+ return;
56
+ }
57
+ if (type === 'extract') {
58
+ const {
59
+ expectedFeatures,
60
+ inputRecord
61
+ } = expectations;
62
+ const record = new _marcRecord.MarcRecord(inputRecord, {
63
+ subfieldValues: false
64
+ });
65
+ const {
66
+ extract
67
+ } = features[feature](options);
68
+ (0, _chai.expect)(extract(record)).to.eql(expectedFeatures);
69
+ return;
70
+ }
71
+ if (type === 'compare') {
72
+ const {
73
+ featuresA,
74
+ featuresB,
75
+ expectedPoints
76
+ } = expectations;
77
+ const {
78
+ compare
79
+ } = features[feature](options);
80
+ (0, _chai.expect)(compare(featuresA, featuresB)).to.equal(expectedPoints);
81
+ return;
82
+ }
83
+ throw new Error(`Invalid type ${type}`);
84
+ }
85
+ });
86
+ });
87
+ //# sourceMappingURL=index.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.spec.js","names":["describe","generateTests","path","__dirname","useMetadataFile","fixura","reader","READERS","JSON","callback","enabled","feature","options","type","expectations","expectedFeatures","inputRecord","record","MarcRecord","subfieldValues","extract","features","expect","to","eql","featuresA","featuresB","expectedPoints","compare","equal","Error"],"sources":["../../../../src/match-detection/features/bib/index.spec.js"],"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"],"mappings":";;AA4BA;AACA;AACA;AACA;AACA;AAA8B;AAAA;AAAA;AAhC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;EACF,CAAC,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _standardIdentifierFactory = _interopRequireDefault(require("./standard-identifier-factory"));
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+ /**
10
+ *
11
+ * @licstart The following is the entire license notice for the JavaScript code in this file.
12
+ *
13
+ * Melinda record matching modules for Javascript
14
+ *
15
+ * Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)
16
+ *
17
+ * This file is part of melinda-record-matching-js
18
+ *
19
+ * melinda-record-matching-js program is free software: you can redistribute it and/or modify
20
+ * it under the terms of the GNU Lesser General Public License as
21
+ * published by the Free Software Foundation, either version 3 of the
22
+ * License, or (at your option) any later version.
23
+ *
24
+ * melinda-record-matching-js is distributed in the hope that it will be useful,
25
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
26
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27
+ * GNU Lesser General Public License for more details.
28
+ *
29
+ * You should have received a copy of the GNU Affero General Public License
30
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
31
+ *
32
+ * @licend The above is the entire license notice
33
+ * for the JavaScript code in this file.
34
+ *
35
+ */var _default = () => {
36
+ const {
37
+ extract,
38
+ compare
39
+ } = (0, _standardIdentifierFactory.default)({
40
+ pattern: /^020$/u,
41
+ subfieldCodes: ['a', 'z']
42
+ });
43
+ return {
44
+ extract,
45
+ compare,
46
+ name: 'ISBN'
47
+ };
48
+ };
49
+ exports.default = _default;
50
+ //# sourceMappingURL=isbn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isbn.js","names":["extract","compare","createInterface","pattern","subfieldCodes","name"],"sources":["../../../../src/match-detection/features/bib/isbn.js"],"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"],"mappings":";;;;;;AA4BA;AAA4D;AA5B5D;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,EA1BA,eA8Be,MAAM;EACnB,MAAM;IAACA,OAAO;IAAEC;EAAO,CAAC,GAAG,IAAAC,kCAAe,EAAC;IAACC,OAAO,EAAE,QAAQ;IAAEC,aAAa,EAAE,CAAC,GAAG,EAAE,GAAG;EAAC,CAAC,CAAC;EAC1F,OAAO;IAACJ,OAAO;IAAEC,OAAO;IAAEI,IAAI,EAAE;EAAM,CAAC;AACzC,CAAC;AAAA"}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _standardIdentifierFactory = _interopRequireDefault(require("./standard-identifier-factory"));
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+ /**
10
+ *
11
+ * @licstart The following is the entire license notice for the JavaScript code in this file.
12
+ *
13
+ * Melinda record matching modules for Javascript
14
+ *
15
+ * Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)
16
+ *
17
+ * This file is part of melinda-record-matching-js
18
+ *
19
+ * melinda-record-matching-js program is free software: you can redistribute it and/or modify
20
+ * it under the terms of the GNU Lesser General Public License as
21
+ * published by the Free Software Foundation, either version 3 of the
22
+ * License, or (at your option) any later version.
23
+ *
24
+ * melinda-record-matching-js is distributed in the hope that it will be useful,
25
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
26
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27
+ * GNU Lesser General Public License for more details.
28
+ *
29
+ * You should have received a copy of the GNU Affero General Public License
30
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
31
+ *
32
+ * @licend The above is the entire license notice
33
+ * for the JavaScript code in this file.
34
+ *
35
+ */var _default = () => {
36
+ const {
37
+ extract,
38
+ compare
39
+ } = (0, _standardIdentifierFactory.default)({
40
+ pattern: /^022$/u,
41
+ subfieldCodes: ['a', 'z', 'y']
42
+ });
43
+ return {
44
+ extract,
45
+ compare,
46
+ name: 'ISSN'
47
+ };
48
+ };
49
+ exports.default = _default;
50
+ //# sourceMappingURL=issn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"issn.js","names":["extract","compare","createInterface","pattern","subfieldCodes","name"],"sources":["../../../../src/match-detection/features/bib/issn.js"],"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"],"mappings":";;;;;;AA4BA;AAA4D;AA5B5D;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,EA1BA,eA8Be,MAAM;EACnB,MAAM;IAACA,OAAO;IAAEC;EAAO,CAAC,GAAG,IAAAC,kCAAe,EAAC;IAACC,OAAO,EAAE,QAAQ;IAAEC,aAAa,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG;EAAC,CAAC,CAAC;EAC/F,OAAO;IAACJ,OAAO;IAAEC,OAAO;IAAEI,IAAI,EAAE;EAAM,CAAC;AACzC,CAAC;AAAA"}
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _debug = _interopRequireDefault(require("debug"));
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+ /* eslint-disable max-statements */
10
+ /**
11
+ *
12
+ * @licstart The following is the entire license notice for the JavaScript code in this file.
13
+ *
14
+ * Melinda record matching modules for Javascript
15
+ *
16
+ * Copyright (C) 2020-2022 University Of Helsinki (The National Library Of Finland)
17
+ *
18
+ * This file is part of melinda-record-matching-js
19
+ *
20
+ * melinda-record-matching-js program is free software: you can redistribute it and/or modify
21
+ * it under the terms of the GNU Lesser General Public License as
22
+ * published by the Free Software Foundation, either version 3 of the
23
+ * License, or (at your option) any later version.
24
+ *
25
+ * melinda-record-matching-js is distributed in the hope that it will be useful,
26
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
27
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28
+ * GNU Lesser General Public License for more details.
29
+ *
30
+ * You should have received a copy of the GNU Affero General Public License
31
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
32
+ *
33
+ * @licend The above is the entire license notice
34
+ * for the JavaScript code in this file.
35
+ *
36
+ */
37
+
38
+ const debug = (0, _debug.default)('@natlibfi/melinda-record-matching:match-detection:features:language');
39
+ const debugData = debug.extend('data');
40
+ var _default = () => ({
41
+ name: 'Language',
42
+ extract: record => {
43
+ const value008 = get008Value();
44
+ const values041 = get041Values();
45
+ debugData(`008: ${JSON.stringify(value008)}, 041: ${JSON.stringify(values041)}`);
46
+ if (value008 && values041.length > 0) {
47
+ debugData(`There's both 008 and 041, searching for value in both`);
48
+ const correspondingValue = values041.find(v => v === value008);
49
+ debugData(`Corresponding value: ${correspondingValue}`);
50
+ return correspondingValue ? [correspondingValue] : [];
51
+ }
52
+ if (!value008 && values041.length < 1) {
53
+ debugData(`No actual values found`);
54
+ return [];
55
+ }
56
+ return value008 ? [value008] : [values041[0]];
57
+ function get008Value() {
58
+ var _record$get, _record$get$;
59
+ 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;
60
+ debugData(`008 value: ${value}`);
61
+ if (!value) {
62
+ return undefined;
63
+ }
64
+ const code = value.slice(35, 38);
65
+ debugData(`008 code: ${code}`);
66
+ return code === '|||' || code === ' ' || code === '^^^' ? undefined : code;
67
+ }
68
+
69
+ // Main language for the resource: in the first f041 $a or f041 $d
70
+ // Uses only f041s that have 2nd ind ' ', which means that the codes used are MARC 21 language codes
71
+
72
+ function get041Values() {
73
+ return record.get(/^041$/u).filter(({
74
+ ind2
75
+ }) => ind2 === ' ').map(({
76
+ subfields
77
+ }) => subfields).flat().filter(({
78
+ code
79
+ }) => code === 'a' || code === 'd').map(({
80
+ value
81
+ }) => value);
82
+ }
83
+ },
84
+ compare: (a, b) => {
85
+ debugData(`Comparing ${JSON.stringify(a[0])} and ${JSON.stringify(b[0])}`);
86
+ if (a.length === 0 || b.length === 0) {
87
+ debugData(`No language to compare`);
88
+ return 0;
89
+ }
90
+ debugData(`There are languages to compare`);
91
+ if (a[0] === b[0]) {
92
+ return 0.1;
93
+ }
94
+ return a[0] === 'und' || b[0] === 'und' ? 0.0 : -1.0;
95
+ }
96
+ });
97
+ exports.default = _default;
98
+ //# sourceMappingURL=language.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"language.js","names":["debug","createDebugLogger","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"],"sources":["../../../../src/match-detection/features/bib/language.js"],"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-2022 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 are 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"],"mappings":";;;;;;AA6BA;AAAsC;AA7BtC;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;AACA;;AAIA,MAAMA,KAAK,GAAG,IAAAC,cAAiB,EAAC,qEAAqE,CAAC;AACtG,MAAMC,SAAS,GAAGF,KAAK,CAACG,MAAM,CAAC,MA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exports.default = void 0;
7
+ var _melindaIdentifierFactory = _interopRequireDefault(require("./melinda-identifier-factory"));
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+ /**
10
+ *
11
+ * @licstart The following is the entire license notice for the JavaScript code in this file.
12
+ *
13
+ * Melinda record matching modules for Javascript
14
+ *
15
+ * Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)
16
+ *
17
+ * This file is part of melinda-record-matching-js
18
+ *
19
+ * melinda-record-matching-js program is free software: you can redistribute it and/or modify
20
+ * it under the terms of the GNU Lesser General Public License as
21
+ * published by the Free Software Foundation, either version 3 of the
22
+ * License, or (at your option) any later version.
23
+ *
24
+ * melinda-record-matching-js is distributed in the hope that it will be useful,
25
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
26
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27
+ * GNU Lesser General Public License for more details.
28
+ *
29
+ * You should have received a copy of the GNU Affero General Public License
30
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
31
+ *
32
+ * @licend The above is the entire license notice
33
+ * for the JavaScript code in this file.
34
+ *
35
+ */var _default = () => {
36
+ const {
37
+ extract,
38
+ compare
39
+ } = (0, _melindaIdentifierFactory.default)();
40
+ return {
41
+ extract,
42
+ compare,
43
+ name: 'melinda-id'
44
+ };
45
+ };
46
+ exports.default = _default;
47
+ //# sourceMappingURL=melinda-id.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"melinda-id.js","names":["extract","compare","createInterface","name"],"sources":["../../../../src/match-detection/features/bib/melinda-id.js"],"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"],"mappings":";;;;;;AA4BA;AAA2D;AA5B3D;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,EA1BA,eA8Be,MAAM;EACnB,MAAM;IAACA,OAAO;IAAEC;EAAO,CAAC,GAAG,IAAAC,iCAAe,GAAE;EAC5C,OAAO;IAACF,OAAO;IAAEC,OAAO;IAAEE,IAAI,EAAE;EAAY,CAAC;AAC/C,CAAC;AAAA"}
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _debug = _interopRequireDefault(require("debug"));
8
+ var _matchingUtils = require("../../../matching-utils");
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ /**
11
+ *
12
+ * @licstart The following is the entire license notice for the JavaScript code in this file.
13
+ *
14
+ * Melinda record matching modules for Javascript
15
+ *
16
+ * Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)
17
+ *
18
+ * This file is part of melinda-record-matching-js
19
+ *
20
+ * melinda-record-matching-js program is free software: you can redistribute it and/or modify
21
+ * it under the terms of the GNU Lesser General Public License as
22
+ * published by the Free Software Foundation, either version 3 of the
23
+ * License, or (at your option) any later version.
24
+ *
25
+ * melinda-record-matching-js is distributed in the hope that it will be useful,
26
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
27
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28
+ * GNU Lesser General Public License for more details.
29
+ *
30
+ * You should have received a copy of the GNU Affero General Public License
31
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
32
+ *
33
+ * @licend The above is the entire license notice
34
+ * for the JavaScript code in this file.
35
+ *
36
+ */
37
+ // 003+001 FI-MELINDA <melinda-id>
38
+ // 035 $a (FI-MELINDA)<melinda-id>
39
+ // 035 $z (FI-MELINDA)<melinda-id>
40
+ // 035 $a FCC<melinda-id>
41
+ // 035 $z FCC<melinda-id>
42
+ // melinda-id = 001234567
43
+ var _default = () => {
44
+ const debug = (0, _debug.default)('@natlibfi/melinda-record-matching:match-detection:features/bib/melinda-id');
45
+ const debugData = debug.extend('data');
46
+ return {
47
+ extract,
48
+ compare
49
+ };
50
+ function extract(record) {
51
+ const isMelindaRecord = record.get('003').some(f003 => f003.value === 'FI-MELINDA');
52
+ const [f001] = record.get('001').map(field => field.value);
53
+ const f035MelindaIds = (0, _matchingUtils.getMelindaIdsF035)(record);
54
+ if (isMelindaRecord === undefined && f001 === undefined && f035MelindaIds.length < 1) {
55
+ debug(`No Melinda-IDs found`);
56
+ return {};
57
+ }
58
+ return {
59
+ isMelindaRecord,
60
+ f001,
61
+ f035MelindaIds
62
+ };
63
+ }
64
+
65
+ // eslint-disable-next-line max-statements
66
+ function compare(a, b) {
67
+ if (a.isMelindaRecord && b.isMelindaRecord && a.f001 === b.f001) {
68
+ debugData(`Melinda record's A f001 ${a.f001} matches Melinda record's B f001 ${a.f001}`);
69
+ return 1;
70
+ }
71
+ if (a.isMelindaRecord && typeof b.f035MelindaIds !== 'undefined' && b.f035MelindaIds.some(id => id === a.f001)) {
72
+ debugData(`Melinda record's A f001 ${a.f001} matches record B f035 ${JSON.stringify(b.f035MelindaIds)}`);
73
+ return 1;
74
+ }
75
+ if (b.isMelindaRecord && typeof a.f035MelindaIds !== 'undefined' && a.f035MelindaIds.some(id => id === b.f001)) {
76
+ debugData(`Melinda record's B f001 ${b.f001} matches record A f035 ${JSON.stringify(a.f035MelindaIds)}`);
77
+ return 1;
78
+ }
79
+ if (typeof a.f035MelindaIds !== 'undefined' && typeof b.f035MelindaIds !== 'undefined' && a.f035MelindaIds.some(idA => b.f035MelindaIds.some(idB => idB === idA))) {
80
+ debugData(`Record A f035 ${JSON.stringify(a.f035MelindaIds)} matches record B f035 ${JSON.stringify(b.f035MelindaIds)}`);
81
+ return 1;
82
+ }
83
+ debug(`No matching Melinda-IDs.`);
84
+ return 0;
85
+ }
86
+ };
87
+ exports.default = _default;
88
+ //# sourceMappingURL=melinda-identifier-factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"melinda-identifier-factory.js","names":["debug","createDebugLogger","debugData","extend","extract","compare","record","isMelindaRecord","get","some","f003","value","f001","map","field","f035MelindaIds","getMelindaIdsF035","undefined","length","a","b","id","JSON","stringify","idA","idB"],"sources":["../../../../src/match-detection/features/bib/melinda-identifier-factory.js"],"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"],"mappings":";;;;;;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default = void 0;
7
+ var _standardIdentifierFactory = _interopRequireDefault(require("./standard-identifier-factory"));
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+ /**
10
+ *
11
+ * @licstart The following is the entire license notice for the JavaScript code in this file.
12
+ *
13
+ * Melinda record matching modules for Javascript
14
+ *
15
+ * Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)
16
+ *
17
+ * This file is part of melinda-record-matching-js
18
+ *
19
+ * melinda-record-matching-js program is free software: you can redistribute it and/or modify
20
+ * it under the terms of the GNU Lesser General Public License as
21
+ * published by the Free Software Foundation, either version 3 of the
22
+ * License, or (at your option) any later version.
23
+ *
24
+ * melinda-record-matching-js is distributed in the hope that it will be useful,
25
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
26
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27
+ * GNU Lesser General Public License for more details.
28
+ *
29
+ * You should have received a copy of the GNU Affero General Public License
30
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
31
+ *
32
+ * @licend The above is the entire license notice
33
+ * for the JavaScript code in this file.
34
+ *
35
+ */var _default = () => {
36
+ const {
37
+ extract,
38
+ compare
39
+ } = (0, _standardIdentifierFactory.default)({
40
+ pattern: /^024$/u,
41
+ subfieldCodes: ['a', 'z']
42
+ });
43
+ return {
44
+ extract,
45
+ compare,
46
+ name: 'Other standard identifier'
47
+ };
48
+ };
49
+ exports.default = _default;
50
+ //# sourceMappingURL=other-standard-identifier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"other-standard-identifier.js","names":["extract","compare","createInterface","pattern","subfieldCodes","name"],"sources":["../../../../src/match-detection/features/bib/other-standard-identifier.js"],"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"],"mappings":";;;;;;AA4BA;AAA4D;AA5B5D;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,EA1BA,eA8Be,MAAM;EACnB,MAAM;IAACA,OAAO;IAAEC;EAAO,CAAC,GAAG,IAAAC,kCAAe,EAAC;IAACC,OAAO,EAAE,QAAQ;IAAEC,aAAa,EAAE,CAAC,GAAG,EAAE,GAAG;EAAC,CAAC,CAAC;EAC1F,OAAO;IAACJ,OAAO;IAAEC,OAAO;IAAEI,IAAI,EAAE;EAA2B,CAAC;AAC9D,CAAC;AAAA"}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _matchingUtils = require("../../../matching-utils");
8
+ /**
9
+ *
10
+ * @licstart The following is the entire license notice for the JavaScript code in this file.
11
+ *
12
+ * Melinda record matching modules for Javascript
13
+ *
14
+ * Copyright (C) 2020-2022 University Of Helsinki (The National Library Of Finland)
15
+ *
16
+ * This file is part of melinda-record-matching-js
17
+ *
18
+ * melinda-record-matching-js program is free software: you can redistribute it and/or modify
19
+ * it under the terms of the GNU Lesser General Public License as
20
+ * published by the Free Software Foundation, either version 3 of the
21
+ * License, or (at your option) any later version.
22
+ *
23
+ * melinda-record-matching-js is distributed in the hope that it will be useful,
24
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
25
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26
+ * GNU Lesser General Public License for more details.
27
+ *
28
+ * You should have received a copy of the GNU Affero General Public License
29
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
30
+ *
31
+ * @licend The above is the entire license notice
32
+ * for the JavaScript code in this file.
33
+ *
34
+ */
35
+ // We should also get copyright time and copyright/publication times from 26x
36
+ // We could also enable matching of records which have consequent publication years
37
+ var _default = () => ({
38
+ name: 'Publication time',
39
+ extract: record => {
40
+ var _record$get, _record$get$;
41
+ 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;
42
+ return (0, _matchingUtils.testStringOrNumber)(value) ? [String(value).slice(7, 11)] : [];
43
+ },
44
+ compare: (a, b) => a[0] === b[0] ? 0.1 : -1.0
45
+ });
46
+ exports.default = _default;
47
+ //# sourceMappingURL=publication-time.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publication-time.js","names":["name","extract","record","value","get","undefined","testStringOrNumber","String","slice","compare","a","b"],"sources":["../../../../src/match-detection/features/bib/publication-time.js"],"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-2022 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 {testStringOrNumber} from '../../../matching-utils';\n\n// We should also get copyright time and copyright/publication times from 26x\n// We could also enable matching of records which have consequent publication years\n\nexport default () => ({\n name: 'Publication time',\n extract: record => {\n const value = record.get(/^008$/u)?.[0]?.value || undefined;\n return testStringOrNumber(value) ? [String(value).slice(7, 11)] : [];\n },\n compare: (a, b) => a[0] === b[0] ? 0.1 : -1.0\n});\n"],"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;AAIA;AACA;AAAA,eAEe,OAAO;EACpBA,IAAI,EAAE,kBAAkB;EACxBC,OAAO,EAAEC,MAAM,IAAI;IAAA;IACjB,MAAMC,KAAK,GAAG,gBAAAD,MAAM,CAACE,GAAG,CAAC,QAAQ,CAAC,gEAApB,YAAuB,CAAC,CAAC,iDAAzB,aAA2BD,KAAK,KAAIE,SAAS;IAC3D,OAAO,IAAAC,iCAAkB,EAACH,KAAK,CAAC,GAAG,CAACI,MAAM,CAACJ,KAAK,CAAC,CAACK,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE;EACtE,CAAC;EACDC,OAAO,EAAE,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAAC,CAAC,CAAC,KAAKC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC;AAC5C,CAAC,CAAC;AAAA"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ /**
8
+ *
9
+ * @licstart The following is the entire license notice for the JavaScript code in this file.
10
+ *
11
+ * Melinda record matching modules for Javascript
12
+ *
13
+ * Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)
14
+ *
15
+ * This file is part of melinda-record-matching-js
16
+ *
17
+ * melinda-record-matching-js program is free software: you can redistribute it and/or modify
18
+ * it under the terms of the GNU Lesser General Public License as
19
+ * published by the Free Software Foundation, either version 3 of the
20
+ * License, or (at your option) any later version.
21
+ *
22
+ * melinda-record-matching-js is distributed in the hope that it will be useful,
23
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25
+ * GNU Lesser General Public License for more details.
26
+ *
27
+ * You should have received a copy of the GNU Affero General Public License
28
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
29
+ *
30
+ * @licend The above is the entire license notice
31
+ * for the JavaScript code in this file.
32
+ *
33
+ */
34
+ // we could handle the case of books/notes
35
+ var _default = () => ({
36
+ name: 'Record type',
37
+ extract: r => r.leader[6] ? [r.leader[6]] : [],
38
+ compare: (a, b) => a[0] === b[0] ? 0.1 : -0.5
39
+ });
40
+ exports.default = _default;
41
+ //# sourceMappingURL=record-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"record-type.js","names":["name","extract","r","leader","compare","a","b"],"sources":["../../../../src/match-detection/features/bib/record-type.js"],"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\n// we could handle the case of books/notes\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"],"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;AAEA;AAAA,eAEe,OAAO;EACpBA,IAAI,EAAE,aAAa;EACnBC,OAAO,EAAEC,CAAC,IAAIA,CAAC,CAACC,MAAM,CAAC,CAAC,CAAC,GAAG,CAACD,CAAC,CAACC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE;EAC9CC,OAAO,EAAE,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAAC,CAAC,CAAC,KAAKC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC;AAC5C,CAAC,CAAC;AAAA"}