@natlibfi/melinda-record-matching 4.4.0-alpha.1 → 5.0.0-alpha.2
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.
- package/.github/workflows/melinda-node-tests.yml +13 -9
- package/LICENSE.txt +21 -165
- package/README.md +2 -2
- package/dist/candidate-search/candidate-search-utils.js +6 -43
- package/dist/candidate-search/candidate-search-utils.js.map +7 -1
- package/dist/candidate-search/choose-queries.js +75 -0
- package/dist/candidate-search/choose-queries.js.map +7 -0
- package/dist/candidate-search/index.js +89 -225
- package/dist/candidate-search/index.js.map +7 -1
- package/dist/candidate-search/index.test.js +92 -0
- package/dist/candidate-search/index.test.js.map +7 -0
- package/dist/candidate-search/query-list/bib.js +141 -320
- package/dist/candidate-search/query-list/bib.js.map +7 -1
- package/dist/candidate-search/query-list/bib.test.js +34 -0
- package/dist/candidate-search/query-list/bib.test.js.map +7 -0
- package/dist/candidate-search/query-list/component.js +87 -0
- package/dist/candidate-search/query-list/component.js.map +7 -0
- package/dist/candidate-search/query-list/index.js +39 -52
- package/dist/candidate-search/query-list/index.js.map +7 -1
- package/dist/cli.js +138 -0
- package/dist/cli.js.map +7 -0
- package/dist/index.js +87 -462
- package/dist/index.js.map +7 -1
- package/dist/index.test.js +69 -0
- package/dist/index.test.js.map +7 -0
- package/dist/match-detection/features/bib/all-source-ids.js +20 -91
- package/dist/match-detection/features/bib/all-source-ids.js.map +7 -1
- package/dist/match-detection/features/bib/authors.js +20 -76
- package/dist/match-detection/features/bib/authors.js.map +7 -1
- package/dist/match-detection/features/bib/bibliographic-level.js +4 -40
- package/dist/match-detection/features/bib/bibliographic-level.js.map +7 -1
- package/dist/match-detection/features/bib/host-component.js +5 -41
- package/dist/match-detection/features/bib/host-component.js.map +7 -1
- package/dist/match-detection/features/bib/index.js +17 -119
- package/dist/match-detection/features/bib/index.js.map +7 -1
- package/dist/match-detection/features/bib/index.test.js +40 -0
- package/dist/match-detection/features/bib/index.test.js.map +7 -0
- package/dist/match-detection/features/bib/isbn.js +13 -69
- package/dist/match-detection/features/bib/isbn.js.map +7 -1
- package/dist/match-detection/features/bib/issn.js +5 -50
- package/dist/match-detection/features/bib/issn.js.map +7 -1
- package/dist/match-detection/features/bib/language.js +25 -86
- package/dist/match-detection/features/bib/language.js.map +7 -1
- package/dist/match-detection/features/bib/media-type.js +12 -64
- package/dist/match-detection/features/bib/media-type.js.map +7 -1
- package/dist/match-detection/features/bib/melinda-id.js +5 -47
- package/dist/match-detection/features/bib/melinda-id.js.map +7 -1
- package/dist/match-detection/features/bib/melinda-identifier-factory.js +16 -67
- package/dist/match-detection/features/bib/melinda-identifier-factory.js.map +7 -1
- package/dist/match-detection/features/bib/other-standard-identifier.js +5 -51
- package/dist/match-detection/features/bib/other-standard-identifier.js.map +7 -1
- package/dist/match-detection/features/bib/publication-time-allow-cons-years-multi.js +49 -189
- package/dist/match-detection/features/bib/publication-time-allow-cons-years-multi.js.map +7 -1
- package/dist/match-detection/features/bib/publication-time-allow-cons-years.js +10 -53
- package/dist/match-detection/features/bib/publication-time-allow-cons-years.js.map +7 -1
- package/dist/match-detection/features/bib/publication-time.js +8 -46
- package/dist/match-detection/features/bib/publication-time.js.map +7 -1
- package/dist/match-detection/features/bib/record-type.js +4 -43
- package/dist/match-detection/features/bib/record-type.js.map +7 -1
- package/dist/match-detection/features/bib/standard-identifier-factory.js +47 -163
- package/dist/match-detection/features/bib/standard-identifier-factory.js.map +7 -1
- package/dist/match-detection/features/bib/title-version-original.js +11 -53
- package/dist/match-detection/features/bib/title-version-original.js.map +7 -1
- package/dist/match-detection/features/bib/title.js +20 -72
- package/dist/match-detection/features/bib/title.js.map +7 -1
- package/dist/match-detection/features/index.js +3 -11
- package/dist/match-detection/features/index.js.map +7 -1
- package/dist/match-detection/index.js +35 -150
- package/dist/match-detection/index.js.map +7 -1
- package/dist/match-detection/index.test.js +44 -0
- package/dist/match-detection/index.test.js.map +7 -0
- package/dist/matching-utils.js +38 -102
- package/dist/matching-utils.js.map +7 -1
- package/eslint.config.js +52 -0
- package/example.env +4 -0
- package/package.json +29 -78
- package/src/candidate-search/candidate-search-utils.js +1 -28
- package/src/candidate-search/choose-queries.js +93 -0
- package/src/candidate-search/index.js +85 -119
- package/src/candidate-search/{index.spec.js → index.test.js} +30 -43
- package/src/candidate-search/query-list/bib.js +54 -55
- package/src/candidate-search/query-list/bib.test.js +38 -0
- package/src/candidate-search/query-list/component.js +127 -0
- package/src/candidate-search/query-list/index.js +31 -35
- package/src/cli.js +177 -0
- package/src/index.js +27 -68
- package/src/{index.spec.js → index.test.js} +11 -42
- package/src/match-detection/features/bib/all-source-ids.js +2 -29
- package/src/match-detection/features/bib/authors.js +5 -30
- package/src/match-detection/features/bib/bibliographic-level.js +0 -27
- package/src/match-detection/features/bib/host-component.js +0 -27
- package/src/match-detection/features/bib/index.js +16 -43
- package/src/match-detection/features/bib/index.test.js +52 -0
- package/src/match-detection/features/bib/isbn.js +2 -29
- package/src/match-detection/features/bib/issn.js +1 -28
- package/src/match-detection/features/bib/language.js +5 -32
- package/src/match-detection/features/bib/media-type.js +2 -28
- package/src/match-detection/features/bib/melinda-id.js +1 -28
- package/src/match-detection/features/bib/melinda-identifier-factory.js +5 -32
- package/src/match-detection/features/bib/other-standard-identifier.js +1 -28
- package/src/match-detection/features/bib/publication-time-allow-cons-years-multi.js +7 -34
- package/src/match-detection/features/bib/publication-time-allow-cons-years.js +1 -28
- package/src/match-detection/features/bib/publication-time.js +2 -28
- package/src/match-detection/features/bib/record-type.js +0 -27
- package/src/match-detection/features/bib/standard-identifier-factory.js +1 -28
- package/src/match-detection/features/bib/title-version-original.js +2 -28
- package/src/match-detection/features/bib/title.js +6 -34
- package/src/match-detection/features/index.js +1 -28
- package/src/match-detection/index.js +1 -28
- package/src/match-detection/{index.spec.js → index.test.js} +9 -35
- package/src/matching-utils.js +8 -37
- package/dist/candidate-search/index.spec.js +0 -144
- package/dist/candidate-search/index.spec.js.map +0 -1
- package/dist/candidate-search/query-list/bib.spec.js +0 -64
- package/dist/candidate-search/query-list/bib.spec.js.map +0 -1
- package/dist/index.spec.js +0 -127
- package/dist/index.spec.js.map +0 -1
- package/dist/match-detection/features/bib/index.spec.js +0 -93
- package/dist/match-detection/features/bib/index.spec.js.map +0 -1
- package/dist/match-detection/index.spec.js +0 -91
- package/dist/match-detection/index.spec.js.map +0 -1
- package/src/candidate-search/query-list/bib.spec.js +0 -54
- package/src/match-detection/features/bib/index.spec.js +0 -78
|
@@ -1,94 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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-2023 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: ({
|
|
43
|
-
record,
|
|
44
|
-
recordExternal
|
|
45
|
-
}) => {
|
|
46
|
-
const label = recordExternal && recordExternal.label ? recordExternal.label : 'record';
|
|
1
|
+
import createDebugLogger from "debug";
|
|
2
|
+
import { getMatchCounts } from "../../../matching-utils.js";
|
|
3
|
+
const debug = createDebugLogger("@natlibfi/melinda-record-matching:match-detection:features:language");
|
|
4
|
+
const debugData = debug.extend("data");
|
|
5
|
+
export default () => ({
|
|
6
|
+
name: "Language",
|
|
7
|
+
extract: ({ record, recordExternal }) => {
|
|
8
|
+
const label = recordExternal && recordExternal.label ? recordExternal.label : "record";
|
|
47
9
|
const value008 = get008Value();
|
|
48
10
|
const values041 = get041Values();
|
|
49
|
-
debugData(`${label} 008: ${JSON.stringify(value008)}, 041: ${JSON.stringify(values041)}`);
|
|
11
|
+
debugData(`${label}: 008: ${JSON.stringify(value008)}, 041: ${JSON.stringify(values041)}`);
|
|
50
12
|
if (!value008 && values041.length < 1) {
|
|
51
|
-
debugData(
|
|
13
|
+
debugData(`${label}: No actual values found`);
|
|
52
14
|
return [];
|
|
53
15
|
}
|
|
54
|
-
const allValues = value008 ===
|
|
16
|
+
const allValues = value008 === void 0 ? values041 : values041.concat(value008);
|
|
55
17
|
const uniqueSortedValues = [...new Set(allValues)].sort();
|
|
56
18
|
return uniqueSortedValues;
|
|
57
19
|
function get008Value() {
|
|
58
|
-
const value = record.get(/^008$/u)?.[0]?.value ||
|
|
59
|
-
debugData(`${label} 008 value: ${value}`);
|
|
20
|
+
const value = record.get(/^008$/u)?.[0]?.value || void 0;
|
|
21
|
+
debugData(`${label}: 008 value: ${value}`);
|
|
60
22
|
if (!value) {
|
|
61
|
-
return
|
|
23
|
+
return void 0;
|
|
62
24
|
}
|
|
63
25
|
const code = value.slice(35, 38);
|
|
64
|
-
debugData(`${label} 008 code: ${code}`);
|
|
65
|
-
return isLangCodeForALanguage(code) ? code :
|
|
26
|
+
debugData(`${label}: 008 code: ${code}`);
|
|
27
|
+
return isLangCodeForALanguage(code) ? code : void 0;
|
|
66
28
|
}
|
|
67
|
-
|
|
68
|
-
// Uses only f041s that have 2nd ind ' ', which means that the codes used are MARC 21 language codes
|
|
69
|
-
|
|
70
29
|
function get041Values() {
|
|
71
|
-
return record.get(/^041$/u).filter(({
|
|
72
|
-
ind2
|
|
73
|
-
}) => ind2 === ' ').map(({
|
|
74
|
-
subfields
|
|
75
|
-
}) => subfields).flat().filter(({
|
|
76
|
-
code
|
|
77
|
-
}) => code === 'a' || code === 'd').filter(({
|
|
78
|
-
value
|
|
79
|
-
}) => value && isLangCodeForALanguage(value)).map(({
|
|
80
|
-
value
|
|
81
|
-
}) => value);
|
|
30
|
+
return record.get(/^041$/u).filter(({ ind2 }) => ind2 === " ").map(({ subfields }) => subfields).flat().filter(({ code }) => code === "a" || code === "d").filter(({ value }) => value && isLangCodeForALanguage(value)).map(({ value }) => value);
|
|
82
31
|
}
|
|
83
|
-
|
|
84
|
-
// Check if a string is a possible, validly formed language code for a single language
|
|
85
|
-
// Currently accept also codes in capitals
|
|
86
32
|
function isLangCodeForALanguage(code) {
|
|
87
33
|
if (code.length !== 3) {
|
|
88
34
|
debugData(`Code ${code} is not correct length (3) for a language code.`);
|
|
89
35
|
return false;
|
|
90
36
|
}
|
|
91
|
-
if (code ===
|
|
37
|
+
if (code === "|||" || code === " " || code === "^^^" || code === "mul" || code === "zxx") {
|
|
92
38
|
debugData(`Code ${code} is not code for a spesific language.`);
|
|
93
39
|
return false;
|
|
94
40
|
}
|
|
@@ -111,31 +57,24 @@ var _default = () => ({
|
|
|
111
57
|
debugData(`All languages match`);
|
|
112
58
|
return 0.1;
|
|
113
59
|
}
|
|
114
|
-
const {
|
|
115
|
-
matchingValues,
|
|
116
|
-
possibleMatchValues,
|
|
117
|
-
maxValues
|
|
118
|
-
} = (0, _matchingUtils.getMatchCounts)(a, b);
|
|
60
|
+
const { matchingValues, possibleMatchValues, maxValues } = getMatchCounts(a, b);
|
|
119
61
|
if (matchingValues < 1) {
|
|
120
62
|
debug(`Both have languages, but none of these match.`);
|
|
121
|
-
return -1
|
|
63
|
+
return -1;
|
|
122
64
|
}
|
|
123
65
|
debug(`Both have languages, ${matchingValues}/${possibleMatchValues} valid languages match.`);
|
|
124
|
-
// ignore non-matches if there is mismatching amount of values
|
|
125
66
|
debug(`Possible matches: ${possibleMatchValues}/${maxValues}`);
|
|
126
|
-
//we give some kind of penalty for mismatching amount of values instead of simple divide?
|
|
127
67
|
const missingCount = maxValues - possibleMatchValues;
|
|
128
68
|
const misMatchCount = possibleMatchValues - matchingValues;
|
|
129
|
-
debug(
|
|
130
|
-
debug(
|
|
69
|
+
debug(` missing: ${missingCount}`);
|
|
70
|
+
debug(` mismatches: ${misMatchCount}`);
|
|
131
71
|
const penaltyForMissing = 0.02 * (maxValues - possibleMatchValues);
|
|
132
72
|
const penaltyForMisMatch = 0.05 * (possibleMatchValues - matchingValues);
|
|
133
|
-
debug(
|
|
134
|
-
debug(
|
|
73
|
+
debug(` points: penaltyForMissing: ${penaltyForMissing}`);
|
|
74
|
+
debug(` points: penaltyForMisMatch: ${penaltyForMisMatch}`);
|
|
135
75
|
const points = Number(Number(0.1 - penaltyForMisMatch - penaltyForMissing).toFixed(2));
|
|
136
76
|
debug(`Total points: ${points}`);
|
|
137
77
|
return points;
|
|
138
78
|
}
|
|
139
79
|
});
|
|
140
|
-
|
|
141
|
-
//# sourceMappingURL=language.js.map
|
|
80
|
+
//# sourceMappingURL=language.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/match-detection/features/bib/language.js"],
|
|
4
|
+
"sourcesContent": ["\nimport createDebugLogger from 'debug';\nimport {getMatchCounts} from '../../../matching-utils.js';\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, recordExternal}) => {\n const label = recordExternal && recordExternal.label ? recordExternal.label : 'record';\n\n const value008 = get008Value();\n const values041 = get041Values();\n debugData(`${label}: 008: ${JSON.stringify(value008)}, 041: ${JSON.stringify(values041)}`);\n\n if (!value008 && values041.length < 1) {\n debugData(`${label}: No actual values found`);\n return [];\n }\n\n const allValues = value008 === undefined ? values041 : values041.concat(value008);\n const uniqueSortedValues = [...new Set(allValues)].sort();\n\n return uniqueSortedValues;\n\n function get008Value() {\n const value = record.get(/^008$/u)?.[0]?.value || undefined;\n debugData(`${label}: 008 value: ${value}`);\n\n if (!value) {\n return undefined;\n }\n\n const code = value.slice(35, 38);\n debugData(`${label}: 008 code: ${code}`);\n return isLangCodeForALanguage(code) ? code : undefined;\n }\n\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 .filter(({value}) => value && isLangCodeForALanguage(value))\n .map(({value}) => value);\n }\n\n // Check if a string is a possible, validly formed language code for a single language\n // Currently accept also codes in capitals\n function isLangCodeForALanguage(code) {\n if (code.length !== 3) {\n debugData(`Code ${code} is not correct length (3) for a language code.`);\n return false;\n }\n if (code === '|||' || code === ' ' || code === '^^^' || code === 'mul' || code === 'zxx') {\n debugData(`Code ${code} is not code for a spesific language.`);\n return false;\n }\n const langCodePattern = /^[a-z][a-z][a-z]$/ui;\n if (!langCodePattern.test(code)) {\n debugData(`Code ${code} is not valid as a language code`);\n return false;\n }\n return true;\n }\n\n },\n // eslint-disable-next-line max-statements\n compare: (a, b) => {\n debugData(`Comparing ${JSON.stringify(a)} and ${JSON.stringify(b)}`);\n\n if (a.length === 0 || b.length === 0) {\n debugData(`No language to compare`);\n return 0;\n }\n\n if (a.length === b.length && a.every((element, index) => element === b[index])) {\n debugData(`All languages match`);\n return 0.1;\n }\n\n const {matchingValues, possibleMatchValues, maxValues} = getMatchCounts(a, b);\n\n if (matchingValues < 1) {\n debug(`Both have languages, but none of these match.`);\n return -1.0;\n }\n debug(`Both have languages, ${matchingValues}/${possibleMatchValues} valid languages match.`);\n // ignore non-matches if there is mismatching amount of values\n debug(`Possible matches: ${possibleMatchValues}/${maxValues}`);\n //we give some kind of penalty for mismatching amount of values instead of simple divide?\n const missingCount = maxValues - possibleMatchValues;\n const misMatchCount = possibleMatchValues - matchingValues;\n debug(`\\t missing: ${missingCount}`);\n debug(`\\t mismatches: ${misMatchCount}`);\n\n const penaltyForMissing = 0.02 * (maxValues - possibleMatchValues);\n const penaltyForMisMatch = 0.05 * (possibleMatchValues - matchingValues);\n debug(`\\t points: penaltyForMissing: ${penaltyForMissing}`);\n debug(`\\t points: penaltyForMisMatch: ${penaltyForMisMatch}`);\n\n const points = Number(Number(0.1 - penaltyForMisMatch - penaltyForMissing).toFixed(2));\n debug(`Total points: ${points}`);\n\n return points;\n }\n});\n"],
|
|
5
|
+
"mappings": "AACA,OAAO,uBAAuB;AAC9B,SAAQ,sBAAqB;AAE7B,MAAM,QAAQ,kBAAkB,qEAAqE;AACrG,MAAM,YAAY,MAAM,OAAO,MAAM;AAErC,eAAe,OAAO;AAAA,EACpB,MAAM;AAAA,EACN,SAAS,CAAC,EAAC,QAAQ,eAAc,MAAM;AACrC,UAAM,QAAQ,kBAAkB,eAAe,QAAQ,eAAe,QAAQ;AAE9E,UAAM,WAAW,YAAY;AAC7B,UAAM,YAAY,aAAa;AAC/B,cAAU,GAAG,KAAK,UAAU,KAAK,UAAU,QAAQ,CAAC,UAAU,KAAK,UAAU,SAAS,CAAC,EAAE;AAEzF,QAAI,CAAC,YAAY,UAAU,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|
-
/* 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:media-type');
|
|
39
|
-
const debugData = debug.extend('data');
|
|
40
|
-
var _default = () => ({
|
|
41
|
-
name: 'Media type',
|
|
42
|
-
extract: ({
|
|
43
|
-
record,
|
|
44
|
-
recordExternal
|
|
45
|
-
}) => {
|
|
46
|
-
const label = recordExternal && recordExternal.label ? recordExternal.label : 'record';
|
|
1
|
+
import createDebugLogger from "debug";
|
|
2
|
+
const debug = createDebugLogger("@natlibfi/melinda-record-matching:match-detection:features:media-type");
|
|
3
|
+
const debugData = debug.extend("data");
|
|
4
|
+
export default () => ({
|
|
5
|
+
name: "Media type",
|
|
6
|
+
extract: ({ record, recordExternal }) => {
|
|
7
|
+
const label = recordExternal && recordExternal.label ? recordExternal.label : "record";
|
|
47
8
|
debugData(`Record (${label}): ${JSON.stringify(record)}`);
|
|
48
9
|
debugData(`RecordExternal: ${JSON.stringify(recordExternal)}`);
|
|
49
10
|
const values337 = get337Values();
|
|
50
|
-
debug(`${label} 337 $b values: ${JSON.stringify(values337)}`);
|
|
11
|
+
debug(`${label}: 337 $b values: ${JSON.stringify(values337)}`);
|
|
51
12
|
return values337;
|
|
52
13
|
function get337Values() {
|
|
53
|
-
return record.get(/^337$/u).filter(f => f.subfields.some(subfield => subfield.code ===
|
|
54
|
-
subfields
|
|
55
|
-
}) => subfields).flat().filter(({
|
|
56
|
-
code
|
|
57
|
-
}) => code === 'b').map(({
|
|
58
|
-
value
|
|
59
|
-
}) => value);
|
|
14
|
+
return record.get(/^337$/u).filter((f) => f.subfields.some((subfield) => subfield.code === "2" && subfield.value === "rdamedia")).map(({ subfields }) => subfields).flat().filter(({ code }) => code === "b").map(({ value }) => value);
|
|
60
15
|
}
|
|
61
16
|
},
|
|
62
17
|
compare: (a, b) => {
|
|
63
18
|
debugData(`Comparing ${JSON.stringify(a)} and ${JSON.stringify(b)}`);
|
|
64
|
-
|
|
65
|
-
// Should we give extra good points if all mediaTypes match?
|
|
66
|
-
// Should we give partial points for partially matching mediaTypes?
|
|
67
|
-
// Should we check whether recordType is 'mixedMaterials'
|
|
68
|
-
// Should we okay typical cases of not totally matching mediaTypes? What would these be?
|
|
69
|
-
|
|
70
|
-
if (a.every(elem => b.includes(elem))) {
|
|
19
|
+
if (a.every((elem) => b.includes(elem))) {
|
|
71
20
|
debug(`All mediaTypes from A are in B`);
|
|
72
21
|
return 1;
|
|
73
22
|
}
|
|
74
|
-
if (b.every(elem => a.includes(elem))) {
|
|
23
|
+
if (b.every((elem) => a.includes(elem))) {
|
|
75
24
|
debug(`All mediaTypes from B are in A`);
|
|
76
25
|
return 1;
|
|
77
26
|
}
|
|
@@ -79,5 +28,4 @@ var _default = () => ({
|
|
|
79
28
|
return -1;
|
|
80
29
|
}
|
|
81
30
|
});
|
|
82
|
-
|
|
83
|
-
//# sourceMappingURL=media-type.js.map
|
|
31
|
+
//# sourceMappingURL=media-type.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/match-detection/features/bib/media-type.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-statements */\n\n\nimport createDebugLogger from 'debug';\n\nconst debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features:media-type');\nconst debugData = debug.extend('data');\n\nexport default () => ({\n name: 'Media type',\n extract: ({record, recordExternal}) => {\n const label = recordExternal && recordExternal.label ? recordExternal.label : 'record';\n debugData(`Record (${label}): ${JSON.stringify(record)}`);\n debugData(`RecordExternal: ${JSON.stringify(recordExternal)}`);\n const values337 = get337Values();\n debug(`${label}: 337 $b values: ${JSON.stringify(values337)}`);\n\n return values337;\n\n function get337Values() {\n return record.get(/^337$/u)\n .filter(f => f.subfields.some((subfield) => subfield.code === '2' && subfield.value === 'rdamedia'))\n .map(({subfields}) => subfields)\n .flat()\n .filter(({code}) => code === 'b')\n .map(({value}) => value);\n }\n },\n compare: (a, b) => {\n debugData(`Comparing ${JSON.stringify(a)} and ${JSON.stringify(b)}`);\n\n // Should we give extra good points if all mediaTypes match?\n // Should we give partial points for partially matching mediaTypes?\n // Should we check whether recordType is 'mixedMaterials'\n // Should we okay typical cases of not totally matching mediaTypes? What would these be?\n\n if (a.every(elem => b.includes(elem))) {\n debug(`All mediaTypes from A are in B`);\n return 1;\n }\n\n if (b.every(elem => a.includes(elem))) {\n debug(`All mediaTypes from B are in A`);\n return 1;\n }\n\n debug(`Mismatch in mediaTypes between A and B`);\n return -1;\n\n }\n});\n"],
|
|
5
|
+
"mappings": "AAGA,OAAO,uBAAuB;AAE9B,MAAM,QAAQ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= 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
|
-
*/
|
|
36
|
-
var _default = () => {
|
|
37
|
-
const {
|
|
38
|
-
extract,
|
|
39
|
-
compare
|
|
40
|
-
} = (0, _melindaIdentifierFactory.default)();
|
|
41
|
-
return {
|
|
42
|
-
extract,
|
|
43
|
-
compare,
|
|
44
|
-
name: 'melinda-id'
|
|
45
|
-
};
|
|
1
|
+
import createInterface from "./melinda-identifier-factory.js";
|
|
2
|
+
export default () => {
|
|
3
|
+
const { extract, compare } = createInterface();
|
|
4
|
+
return { extract, compare, name: "melinda-id" };
|
|
46
5
|
};
|
|
47
|
-
|
|
48
|
-
//# sourceMappingURL=melinda-id.js.map
|
|
6
|
+
//# sourceMappingURL=melinda-id.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/match-detection/features/bib/melinda-id.js"],
|
|
4
|
+
"sourcesContent": ["\nimport createInterface from './melinda-identifier-factory.js';\n\nexport default () => {\n const {extract, compare} = createInterface();\n return {extract, compare, name: 'melinda-id'};\n};\n"],
|
|
5
|
+
"mappings": "AACA,OAAO,qBAAqB;AAE5B,eAAe,MAAM;AACnB,QAAM,EAAC,SAAS,QAAO,IAAI,gBAAgB;AAC3C,SAAO,EAAC,SAAS,SAAS,MAAM,aAAY;AAC9C;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,83 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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({
|
|
51
|
-
record,
|
|
52
|
-
recordExternal
|
|
53
|
-
}) {
|
|
54
|
-
const isMelindaRecord = record.get('003').some(f003 => f003.value === 'FI-MELINDA');
|
|
55
|
-
const [f001] = record.get('001').map(field => field.value);
|
|
56
|
-
const f035MelindaIds = (0, _matchingUtils.getMelindaIdsF035)(record);
|
|
57
|
-
if (isMelindaRecord === undefined && f001 === undefined && f035MelindaIds.length < 1) {
|
|
1
|
+
import createDebugLogger from "debug";
|
|
2
|
+
import { getMelindaIdsF035 } from "../../../matching-utils.js";
|
|
3
|
+
export default () => {
|
|
4
|
+
const debug = createDebugLogger("@natlibfi/melinda-record-matching:match-detection:features/bib/melinda-id");
|
|
5
|
+
const debugData = debug.extend("data");
|
|
6
|
+
return { extract, compare };
|
|
7
|
+
function extract({ record, recordExternal }) {
|
|
8
|
+
const isMelindaRecord = record.get("003").some((f003) => f003.value === "FI-MELINDA");
|
|
9
|
+
const [f001] = record.get("001").map((field) => field.value);
|
|
10
|
+
const f035MelindaIds = getMelindaIdsF035(record);
|
|
11
|
+
if (isMelindaRecord === void 0 && f001 === void 0 && f035MelindaIds.length < 1) {
|
|
58
12
|
debug(`${recordExternal.label} No Melinda-IDs found`);
|
|
59
13
|
return {};
|
|
60
14
|
}
|
|
61
|
-
return {
|
|
62
|
-
isMelindaRecord,
|
|
63
|
-
f001,
|
|
64
|
-
f035MelindaIds
|
|
65
|
-
};
|
|
15
|
+
return { isMelindaRecord, f001, f035MelindaIds };
|
|
66
16
|
}
|
|
67
17
|
function compare(a, b) {
|
|
68
18
|
if (a.isMelindaRecord && b.isMelindaRecord && a.f001 === b.f001) {
|
|
69
19
|
debugData(`Melinda record's A f001 ${a.f001} matches Melinda record's B f001 ${a.f001}`);
|
|
70
20
|
return 1;
|
|
71
21
|
}
|
|
72
|
-
if (a.isMelindaRecord && typeof b.f035MelindaIds !==
|
|
22
|
+
if (a.isMelindaRecord && typeof b.f035MelindaIds !== "undefined" && b.f035MelindaIds.some((id) => id === a.f001)) {
|
|
73
23
|
debugData(`Melinda record's A f001 ${a.f001} matches record B f035 ${JSON.stringify(b.f035MelindaIds)}`);
|
|
74
24
|
return 1;
|
|
75
25
|
}
|
|
76
|
-
if (b.isMelindaRecord && typeof a.f035MelindaIds !==
|
|
26
|
+
if (b.isMelindaRecord && typeof a.f035MelindaIds !== "undefined" && a.f035MelindaIds.some((id) => id === b.f001)) {
|
|
77
27
|
debugData(`Melinda record's B f001 ${b.f001} matches record A f035 ${JSON.stringify(a.f035MelindaIds)}`);
|
|
78
28
|
return 1;
|
|
79
29
|
}
|
|
80
|
-
if (typeof a.f035MelindaIds !==
|
|
30
|
+
if (typeof a.f035MelindaIds !== "undefined" && typeof b.f035MelindaIds !== "undefined" && a.f035MelindaIds.some((idA) => b.f035MelindaIds.some((idB) => idB === idA))) {
|
|
81
31
|
debugData(`Record A f035 ${JSON.stringify(a.f035MelindaIds)} matches record B f035 ${JSON.stringify(b.f035MelindaIds)}`);
|
|
82
32
|
return 1;
|
|
83
33
|
}
|
|
@@ -85,5 +35,4 @@ var _default = () => {
|
|
|
85
35
|
return 0;
|
|
86
36
|
}
|
|
87
37
|
};
|
|
88
|
-
|
|
89
|
-
//# sourceMappingURL=melinda-identifier-factory.js.map
|
|
38
|
+
//# sourceMappingURL=melinda-identifier-factory.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/match-detection/features/bib/melinda-identifier-factory.js"],
|
|
4
|
+
"sourcesContent": ["\nimport createDebugLogger from 'debug';\nimport {getMelindaIdsF035} from '../../../matching-utils.js';\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, recordExternal}) {\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(`${recordExternal.label} No Melinda-IDs found`);\n return {};\n }\n\n return {isMelindaRecord, f001, f035MelindaIds};\n\n }\n\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"],
|
|
5
|
+
"mappings": "AACA,OAAO,uBAAuB;AAC9B,SAAQ,yBAAwB;AAShC,eAAe,MAAM;AAEnB,QAAM,QAAQ,kBAAkB,2EAA2E;AAC3G,QAAM,YAAY,MAAM,OAAO,MAAM;AAErC,SAAO,EAAC,SAAS,QAAO;AAExB,WAAS,QAAQ,EAAC,QAAQ,eAAc,GAAG;AAEzC,UAAM,kBAAkB,OAAO,IAAI,KAAK,EAAE,KAAK,UAAQ,KAAK,UAAU,YAAY;AAClF,UAAM,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,EAAE,IAAI,WAAS,MAAM,KAAK;AACzD,UAAM,iBAAiB,kBAAkB,MAAM;AAE/C,QACE,oBAAoB,UACpB,SAAS,UACT,eAAe,SAAS,GAAG;AAE3B,YAAM,GAAG,eAAe,KAAK,uBAAuB;AACpD,aAAO,CAAC;AAAA,IACV;AAEA,WAAO,EAAC,iBAAiB,MAAM,eAAc;AAAA,EAE/C;AAEA,WAAS,QAAQ,GAAG,GAAG;AAErB,QAAI,EAAE,mBAAmB,EAAE,mBACzB,EAAE,SAAS,EAAE,MAAM;AACnB,gBAAU,2BAA2B,EAAE,IAAI,oCAAoC,EAAE,IAAI,EAAE;AACvF,aAAO;AAAA,IACT;AAEA,QAAI,EAAE,mBAAmB,OAAO,EAAE,mBAAmB,eACnD,EAAE,eAAe,KAAK,QAAM,OAAO,EAAE,IAAI,GAAG;AAC5C,gBAAU,2BAA2B,EAAE,IAAI,0BAA0B,KAAK,UAAU,EAAE,cAAc,CAAC,EAAE;AACvG,aAAO;AAAA,IACT;AAEA,QAAI,EAAE,mBAAmB,OAAO,EAAE,mBAAmB,eACnD,EAAE,eAAe,KAAK,QAAM,OAAO,EAAE,IAAI,GAAG;AAC5C,gBAAU,2BAA2B,EAAE,IAAI,0BAA0B,KAAK,UAAU,EAAE,cAAc,CAAC,EAAE;AACvG,aAAO;AAAA,IACT;AAEA,QAAI,OAAO,EAAE,mBAAmB,eAAe,OAAO,EAAE,mBAAmB,eACzE,EAAE,eAAe,KAAK,SAAO,EAAE,eAAe,KAAK,SAAO,QAAQ,GAAG,CAAC,GAAG;AACzE,gBAAU,iBAAiB,KAAK,UAAU,EAAE,cAAc,CAAC,0BAA0B,KAAK,UAAU,EAAE,cAAc,CAAC,EAAE;AACvH,aAAO;AAAA,IACT;AACA,UAAM,0BAA0B;AAChC,WAAO;AAAA,EACT;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,52 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
*/
|
|
36
|
-
// DEVELOP: we should compare indicators and sf2 for f024
|
|
37
|
-
var _default = () => {
|
|
38
|
-
const {
|
|
39
|
-
extract,
|
|
40
|
-
compare
|
|
41
|
-
} = (0, _standardIdentifierFactory.default)({
|
|
42
|
-
pattern: /^024$/u,
|
|
43
|
-
subfieldCodes: ['a', 'z']
|
|
44
|
-
});
|
|
45
|
-
return {
|
|
46
|
-
extract,
|
|
47
|
-
compare,
|
|
48
|
-
name: 'Other standard identifier'
|
|
49
|
-
};
|
|
1
|
+
import createInterface from "./standard-identifier-factory.js";
|
|
2
|
+
export default () => {
|
|
3
|
+
const { extract, compare } = createInterface({ pattern: /^024$/u, subfieldCodes: ["a", "z"] });
|
|
4
|
+
return { extract, compare, name: "Other standard identifier" };
|
|
50
5
|
};
|
|
51
|
-
|
|
52
|
-
//# sourceMappingURL=other-standard-identifier.js.map
|
|
6
|
+
//# sourceMappingURL=other-standard-identifier.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/match-detection/features/bib/other-standard-identifier.js"],
|
|
4
|
+
"sourcesContent": ["\nimport createInterface from './standard-identifier-factory.js';\n\n// DEVELOP: we should compare indicators and sf2 for f024\n\nexport default () => {\n const {extract, compare} = createInterface({pattern: /^024$/u, subfieldCodes: ['a', 'z']});\n return {extract, compare, name: 'Other standard identifier'};\n};\n"],
|
|
5
|
+
"mappings": "AACA,OAAO,qBAAqB;AAI5B,eAAe,MAAM;AACnB,QAAM,EAAC,SAAS,QAAO,IAAI,gBAAgB,EAAC,SAAS,UAAU,eAAe,CAAC,KAAK,GAAG,EAAC,CAAC;AACzF,SAAO,EAAC,SAAS,SAAS,MAAM,4BAA2B;AAC7D;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|