@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,42 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
var _default = () => ({
|
|
35
|
-
name: 'Bibliographic level',
|
|
36
|
-
extract: ({
|
|
37
|
-
record
|
|
38
|
-
}) => record.leader[7] ? [record.leader[7]] : [],
|
|
1
|
+
export default () => ({
|
|
2
|
+
name: "Bibliographic level",
|
|
3
|
+
extract: ({ record }) => record.leader[7] ? [record.leader[7]] : [],
|
|
39
4
|
compare: (a, b) => a[0] === b[0] ? 0.1 : -0.2
|
|
40
5
|
});
|
|
41
|
-
|
|
42
|
-
//# sourceMappingURL=bibliographic-level.js.map
|
|
6
|
+
//# sourceMappingURL=bibliographic-level.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/match-detection/features/bib/bibliographic-level.js"],
|
|
4
|
+
"sourcesContent": ["\nexport default () => ({\n name: 'Bibliographic level',\n extract: ({record}) => record.leader[7] ? [record.leader[7]] : [],\n compare: (a, b) => a[0] === b[0] ? 0.1 : -0.2\n});\n"],
|
|
5
|
+
"mappings": "AACA,eAAe,OAAO;AAAA,EACpB,MAAM;AAAA,EACN,SAAS,CAAC,EAAC,OAAM,MAAM,OAAO,OAAO,CAAC,IAAI,CAAC,OAAO,OAAO,CAAC,CAAC,IAAI,CAAC;AAAA,EAChE,SAAS,CAAC,GAAG,MAAM,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,MAAM;AAC3C;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,42 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export default () => ({
|
|
2
|
+
name: "Host/Component record",
|
|
3
|
+
extract: ({ record }) => record.get(/^773$/u).length > 0 ? ["component"] : ["host"],
|
|
4
|
+
compare: (a, b) => a[0] === b[0] ? 0 : -1
|
|
5
5
|
});
|
|
6
|
-
|
|
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
|
-
var _default = () => ({
|
|
35
|
-
name: 'Host/Component record',
|
|
36
|
-
extract: ({
|
|
37
|
-
record
|
|
38
|
-
}) => record.get(/^773$/u).length > 0 ? ['component'] : ['host'],
|
|
39
|
-
compare: (a, b) => a[0] === b[0] ? 0.0 : -1.0
|
|
40
|
-
});
|
|
41
|
-
exports.default = _default;
|
|
42
|
-
//# sourceMappingURL=host-component.js.map
|
|
6
|
+
//# sourceMappingURL=host-component.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/match-detection/features/bib/host-component.js"],
|
|
4
|
+
"sourcesContent": ["\nexport default () => ({\n name: 'Host/Component record',\n extract: ({record}) => record.get(/^773$/u).length > 0 ? ['component'] : ['host'],\n compare: (a, b) => a[0] === b[0] ? 0.0 : -1.0\n});\n"],
|
|
5
|
+
"mappings": "AACA,eAAe,OAAO;AAAA,EACpB,MAAM;AAAA,EACN,SAAS,CAAC,EAAC,OAAM,MAAM,OAAO,IAAI,QAAQ,EAAE,SAAS,IAAI,CAAC,WAAW,IAAI,CAAC,MAAM;AAAA,EAChF,SAAS,CAAC,GAAG,MAAM,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,IAAM;AAC3C;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,119 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
Object.defineProperty(exports, "bibliographicLevel", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _bibliographicLevel.default;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "hostComponent", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () {
|
|
27
|
-
return _hostComponent.default;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, "isbn", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function () {
|
|
33
|
-
return _isbn.default;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
Object.defineProperty(exports, "issn", {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function () {
|
|
39
|
-
return _issn.default;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
Object.defineProperty(exports, "language", {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: function () {
|
|
45
|
-
return _language.default;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
Object.defineProperty(exports, "mediaType", {
|
|
49
|
-
enumerable: true,
|
|
50
|
-
get: function () {
|
|
51
|
-
return _mediaType.default;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
Object.defineProperty(exports, "melindaId", {
|
|
55
|
-
enumerable: true,
|
|
56
|
-
get: function () {
|
|
57
|
-
return _melindaId.default;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
Object.defineProperty(exports, "otherStandardIdentifier", {
|
|
61
|
-
enumerable: true,
|
|
62
|
-
get: function () {
|
|
63
|
-
return _otherStandardIdentifier.default;
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
Object.defineProperty(exports, "publicationTime", {
|
|
67
|
-
enumerable: true,
|
|
68
|
-
get: function () {
|
|
69
|
-
return _publicationTime.default;
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
Object.defineProperty(exports, "publicationTimeAllowConsYears", {
|
|
73
|
-
enumerable: true,
|
|
74
|
-
get: function () {
|
|
75
|
-
return _publicationTimeAllowConsYears.default;
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
Object.defineProperty(exports, "publicationTimeAllowConsYearsMulti", {
|
|
79
|
-
enumerable: true,
|
|
80
|
-
get: function () {
|
|
81
|
-
return _publicationTimeAllowConsYearsMulti.default;
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
Object.defineProperty(exports, "recordType", {
|
|
85
|
-
enumerable: true,
|
|
86
|
-
get: function () {
|
|
87
|
-
return _recordType.default;
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
Object.defineProperty(exports, "title", {
|
|
91
|
-
enumerable: true,
|
|
92
|
-
get: function () {
|
|
93
|
-
return _title.default;
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
Object.defineProperty(exports, "titleVersionOriginal", {
|
|
97
|
-
enumerable: true,
|
|
98
|
-
get: function () {
|
|
99
|
-
return _titleVersionOriginal.default;
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
var _hostComponent = _interopRequireDefault(require("./host-component"));
|
|
103
|
-
var _isbn = _interopRequireDefault(require("./isbn"));
|
|
104
|
-
var _issn = _interopRequireDefault(require("./issn"));
|
|
105
|
-
var _otherStandardIdentifier = _interopRequireDefault(require("./other-standard-identifier"));
|
|
106
|
-
var _title = _interopRequireDefault(require("./title"));
|
|
107
|
-
var _titleVersionOriginal = _interopRequireDefault(require("./title-version-original"));
|
|
108
|
-
var _authors = _interopRequireDefault(require("./authors"));
|
|
109
|
-
var _recordType = _interopRequireDefault(require("./record-type"));
|
|
110
|
-
var _publicationTime = _interopRequireDefault(require("./publication-time"));
|
|
111
|
-
var _publicationTimeAllowConsYears = _interopRequireDefault(require("./publication-time-allow-cons-years"));
|
|
112
|
-
var _publicationTimeAllowConsYearsMulti = _interopRequireDefault(require("./publication-time-allow-cons-years-multi"));
|
|
113
|
-
var _language = _interopRequireDefault(require("./language"));
|
|
114
|
-
var _bibliographicLevel = _interopRequireDefault(require("./bibliographic-level"));
|
|
115
|
-
var _melindaId = _interopRequireDefault(require("./melinda-id"));
|
|
116
|
-
var _allSourceIds = _interopRequireDefault(require("./all-source-ids"));
|
|
117
|
-
var _mediaType = _interopRequireDefault(require("./media-type"));
|
|
118
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
119
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export { default as hostComponent } from "./host-component.js";
|
|
2
|
+
export { default as isbn } from "./isbn.js";
|
|
3
|
+
export { default as issn } from "./issn.js";
|
|
4
|
+
export { default as otherStandardIdentifier } from "./other-standard-identifier.js";
|
|
5
|
+
export { default as title } from "./title.js";
|
|
6
|
+
export { default as titleVersionOriginal } from "./title-version-original.js";
|
|
7
|
+
export { default as authors } from "./authors.js";
|
|
8
|
+
export { default as recordType } from "./record-type.js";
|
|
9
|
+
export { default as publicationTime } from "./publication-time.js";
|
|
10
|
+
export { default as publicationTimeAllowConsYears } from "./publication-time-allow-cons-years.js";
|
|
11
|
+
export { default as publicationTimeAllowConsYearsMulti } from "./publication-time-allow-cons-years-multi.js";
|
|
12
|
+
export { default as language } from "./language.js";
|
|
13
|
+
export { default as bibliographicLevel } from "./bibliographic-level.js";
|
|
14
|
+
export { default as melindaId } from "./melinda-id.js";
|
|
15
|
+
export { default as allSourceIds } from "./all-source-ids.js";
|
|
16
|
+
export { default as mediaType } from "./media-type.js";
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/match-detection/features/bib/index.js"],
|
|
4
|
+
"sourcesContent": ["\nexport {default as hostComponent} from './host-component.js';\nexport {default as isbn} from './isbn.js';\nexport {default as issn} from './issn.js';\nexport {default as otherStandardIdentifier} from './other-standard-identifier.js';\nexport {default as title} from './title.js';\nexport {default as titleVersionOriginal} from './title-version-original.js';\nexport {default as authors} from './authors.js';\nexport {default as recordType} from './record-type.js';\nexport {default as publicationTime} from './publication-time.js';\nexport {default as publicationTimeAllowConsYears} from './publication-time-allow-cons-years.js';\nexport {default as publicationTimeAllowConsYearsMulti} from './publication-time-allow-cons-years-multi.js';\nexport {default as language} from './language.js';\nexport {default as bibliographicLevel} from './bibliographic-level.js';\nexport {default as melindaId} from './melinda-id.js';\nexport {default as allSourceIds} from './all-source-ids.js';\nexport {default as mediaType} from './media-type.js';\n"],
|
|
5
|
+
"mappings": "AACA,SAAQ,WAAW,qBAAoB;AACvC,SAAQ,WAAW,YAAW;AAC9B,SAAQ,WAAW,YAAW;AAC9B,SAAQ,WAAW,+BAA8B;AACjD,SAAQ,WAAW,aAAY;AAC/B,SAAQ,WAAW,4BAA2B;AAC9C,SAAQ,WAAW,eAAc;AACjC,SAAQ,WAAW,kBAAiB;AACpC,SAAQ,WAAW,uBAAsB;AACzC,SAAQ,WAAW,qCAAoC;AACvD,SAAQ,WAAW,0CAAyC;AAC5D,SAAQ,WAAW,gBAAe;AAClC,SAAQ,WAAW,0BAAyB;AAC5C,SAAQ,WAAW,iBAAgB;AACnC,SAAQ,WAAW,oBAAmB;AACtC,SAAQ,WAAW,iBAAgB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import assert from "node:assert";
|
|
2
|
+
import { describe } from "node:test";
|
|
3
|
+
import createDebugLogger from "debug";
|
|
4
|
+
import generateTests from "@natlibfi/fixugen";
|
|
5
|
+
import { READERS } from "@natlibfi/fixura";
|
|
6
|
+
import { MarcRecord } from "@natlibfi/marc-record";
|
|
7
|
+
import * as features from "./index.js";
|
|
8
|
+
const debug = createDebugLogger("@natlibfi/melinda-record-matching:match-detection:features/bib:test");
|
|
9
|
+
const debugData = debug.extend("data");
|
|
10
|
+
describe("match-detection/features/bib/", () => {
|
|
11
|
+
generateTests({
|
|
12
|
+
path: [import.meta.dirname, "..", "..", "..", "..", "test-fixtures", "match-detection", "features", "bib"],
|
|
13
|
+
useMetadataFile: true,
|
|
14
|
+
fixura: {
|
|
15
|
+
reader: READERS.JSON
|
|
16
|
+
},
|
|
17
|
+
callback: ({ enabled = true, feature, options, type, ...expectations }) => {
|
|
18
|
+
if (!enabled) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
debug(`Testing: ${feature} ${type}`);
|
|
22
|
+
if (type === "extract") {
|
|
23
|
+
const { expectedFeatures, inputRecord } = expectations;
|
|
24
|
+
const record = new MarcRecord(inputRecord, { subfieldValues: false });
|
|
25
|
+
debugData(`Record: ${record}`);
|
|
26
|
+
const { extract } = features[feature](options);
|
|
27
|
+
assert.deepStrictEqual(extract({ record }), expectedFeatures);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (type === "compare") {
|
|
31
|
+
const { featuresA, featuresB, expectedPoints } = expectations;
|
|
32
|
+
const { compare } = features[feature](options);
|
|
33
|
+
assert.equal(compare(featuresA, featuresB), expectedPoints);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
throw new Error(`Invalid type ${type}`);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=index.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/match-detection/features/bib/index.test.js"],
|
|
4
|
+
"sourcesContent": ["\nimport assert from 'node:assert';\nimport {describe} from 'node:test';\nimport createDebugLogger from 'debug';\nimport generateTests from '@natlibfi/fixugen';\nimport {READERS} from '@natlibfi/fixura';\nimport {MarcRecord} from '@natlibfi/marc-record';\nimport * as features from './index.js';\n\n\nconst debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features/bib:test');\nconst debugData = debug.extend('data');\n\n\ndescribe('match-detection/features/bib/', () => {\n generateTests({\n path: [import.meta.dirname, '..', '..', '..', '..', 'test-fixtures', 'match-detection', 'features', 'bib'],\n useMetadataFile: true,\n fixura: {\n reader: READERS.JSON\n },\n\n callback: ({enabled = true, feature, options, type, ...expectations}) => {\n\n if (!enabled) {\n return;\n }\n\n debug(`Testing: ${feature} ${type}`);\n\n if (type === 'extract') {\n const {expectedFeatures, inputRecord} = expectations;\n const record = new MarcRecord(inputRecord, {subfieldValues: false});\n debugData(`Record: ${record}`);\n const {extract} = features[feature](options);\n\n assert.deepStrictEqual(extract({record}), expectedFeatures);\n return;\n }\n\n if (type === 'compare') {\n const {featuresA, featuresB, expectedPoints} = expectations;\n const {compare} = features[feature](options);\n\n assert.equal(compare(featuresA, featuresB), expectedPoints);\n return;\n }\n\n throw new Error(`Invalid type ${type}`);\n }\n });\n});\n"],
|
|
5
|
+
"mappings": "AACA,OAAO,YAAY;AACnB,SAAQ,gBAAe;AACvB,OAAO,uBAAuB;AAC9B,OAAO,mBAAmB;AAC1B,SAAQ,eAAc;AACtB,SAAQ,kBAAiB;AACzB,YAAY,cAAc;AAG1B,MAAM,QAAQ,kBAAkB,qEAAqE;AACrG,MAAM,YAAY,MAAM,OAAO,MAAM;AAGrC,SAAS,iCAAiC,MAAM;AAC9C,gBAAc;AAAA,IACZ,MAAM,CAAC,YAAY,SAAS,MAAM,MAAM,MAAM,MAAM,iBAAiB,mBAAmB,YAAY,KAAK;AAAA,IACzG,iBAAiB;AAAA,IACjB,QAAQ;AAAA,MACN,QAAQ,QAAQ;AAAA,IAClB;AAAA,IAEA,UAAU,CAAC,EAAC,UAAU,MAAM,SAAS,SAAS,MAAM,GAAG,aAAY,MAAM;AAEvE,UAAI,CAAC,SAAS;AACZ;AAAA,MACF;AAEA,YAAM,YAAY,OAAO,IAAI,IAAI,EAAE;AAEnC,UAAI,SAAS,WAAW;AACtB,cAAM,EAAC,kBAAkB,YAAW,IAAI;AACxC,cAAM,SAAS,IAAI,WAAW,aAAa,EAAC,gBAAgB,MAAK,CAAC;AAClE,kBAAU,WAAW,MAAM,EAAE;AAC7B,cAAM,EAAC,QAAO,IAAI,SAAS,OAAO,EAAE,OAAO;AAE3C,eAAO,gBAAgB,QAAQ,EAAC,OAAM,CAAC,GAAG,gBAAgB;AAC1D;AAAA,MACF;AAEA,UAAI,SAAS,WAAW;AACtB,cAAM,EAAC,WAAW,WAAW,eAAc,IAAI;AAC/C,cAAM,EAAC,QAAO,IAAI,SAAS,OAAO,EAAE,OAAO;AAE3C,eAAO,MAAM,QAAQ,WAAW,SAAS,GAAG,cAAc;AAC1D;AAAA,MACF;AAEA,YAAM,IAAI,MAAM,gBAAgB,IAAI,EAAE;AAAA,IACxC;AAAA,EACF,CAAC;AACH,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,77 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var _isbn = require("isbn3");
|
|
9
|
-
var _debug = _interopRequireDefault(require("debug"));
|
|
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
|
-
const debug = (0, _debug.default)(`@natlibfi/melinda-record-matching:match-detection:features:standard-identifiers:ISBN`);
|
|
40
|
-
const debugData = debug.extend('data');
|
|
41
|
-
var _default = () => {
|
|
42
|
-
const IDENTIFIER_NAME = 'ISBN';
|
|
1
|
+
import createDebugLogger from "debug";
|
|
2
|
+
import { parse as isbnParse } from "isbn3";
|
|
3
|
+
import createInterface from "./standard-identifier-factory.js";
|
|
4
|
+
const debug = createDebugLogger(`@natlibfi/melinda-record-matching:match-detection:features:standard-identifiers:ISBN`);
|
|
5
|
+
const debugData = debug.extend("data");
|
|
6
|
+
export default () => {
|
|
7
|
+
const IDENTIFIER_NAME = "ISBN";
|
|
43
8
|
function validatorAndNormalizer(string) {
|
|
44
|
-
const isbnParseResult = (
|
|
9
|
+
const isbnParseResult = isbnParse(string);
|
|
45
10
|
debugData(`isbnParseResult: ${JSON.stringify(isbnParseResult)}`);
|
|
46
11
|
if (isbnParseResult === null) {
|
|
47
12
|
debug(`Not parseable ISBN, just removing hyphens`);
|
|
48
|
-
return {
|
|
49
|
-
valid: false,
|
|
50
|
-
value: string.replace(/-/ug, '')
|
|
51
|
-
};
|
|
13
|
+
return { valid: false, value: string.replace(/-/ug, "") };
|
|
52
14
|
}
|
|
53
15
|
debug(`Parseable ISBN, normalizing to ISBN-13`);
|
|
54
|
-
return {
|
|
55
|
-
valid: true,
|
|
56
|
-
value: isbnParseResult.isbn13
|
|
57
|
-
};
|
|
16
|
+
return { valid: true, value: isbnParseResult.isbn13 };
|
|
58
17
|
}
|
|
59
|
-
const {
|
|
60
|
-
|
|
61
|
-
compare
|
|
62
|
-
} = (0, _standardIdentifierFactory.default)({
|
|
63
|
-
identifier: IDENTIFIER_NAME,
|
|
64
|
-
pattern: /^020$/u,
|
|
65
|
-
subfieldCodes: ['a', 'z'],
|
|
66
|
-
validIdentifierSubfieldCodes: ['a'],
|
|
67
|
-
invalidIdentifierSubfieldCodes: ['z'],
|
|
68
|
-
validatorAndNormalizer
|
|
69
|
-
});
|
|
70
|
-
return {
|
|
71
|
-
extract,
|
|
72
|
-
compare,
|
|
73
|
-
name: IDENTIFIER_NAME
|
|
74
|
-
};
|
|
18
|
+
const { extract, compare } = createInterface({ identifier: IDENTIFIER_NAME, pattern: /^020$/u, subfieldCodes: ["a", "z"], validIdentifierSubfieldCodes: ["a"], invalidIdentifierSubfieldCodes: ["z"], validatorAndNormalizer });
|
|
19
|
+
return { extract, compare, name: IDENTIFIER_NAME };
|
|
75
20
|
};
|
|
76
|
-
|
|
77
|
-
//# sourceMappingURL=isbn.js.map
|
|
21
|
+
//# sourceMappingURL=isbn.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/match-detection/features/bib/isbn.js"],
|
|
4
|
+
"sourcesContent": ["\nimport createDebugLogger from 'debug';\nimport {parse as isbnParse} from 'isbn3';\nimport createInterface from './standard-identifier-factory.js';\n\nconst debug = createDebugLogger(`@natlibfi/melinda-record-matching:match-detection:features:standard-identifiers:ISBN`);\nconst debugData = debug.extend('data');\n\nexport default () => {\n const IDENTIFIER_NAME = 'ISBN';\n\n function validatorAndNormalizer(string) {\n const isbnParseResult = isbnParse(string);\n debugData(`isbnParseResult: ${JSON.stringify(isbnParseResult)}`);\n if (isbnParseResult === null) {\n debug(`Not parseable ISBN, just removing hyphens`);\n return {valid: false, value: string.replace(/-/ug, '')};\n }\n debug(`Parseable ISBN, normalizing to ISBN-13`);\n return {valid: true, value: isbnParseResult.isbn13};\n }\n\n const {extract, compare} = createInterface({identifier: IDENTIFIER_NAME, pattern: /^020$/u, subfieldCodes: ['a', 'z'], validIdentifierSubfieldCodes: ['a'], invalidIdentifierSubfieldCodes: ['z'], validatorAndNormalizer});\n return {extract, compare, name: IDENTIFIER_NAME};\n};\n\n"],
|
|
5
|
+
"mappings": "AACA,OAAO,uBAAuB;AAC9B,SAAQ,SAAS,iBAAgB;AACjC,OAAO,qBAAqB;AAE5B,MAAM,QAAQ,kBAAkB,sFAAsF;AACtH,MAAM,YAAY,MAAM,OAAO,MAAM;AAErC,eAAe,MAAM;AACnB,QAAM,kBAAkB;AAExB,WAAS,uBAAuB,QAAQ;AACtC,UAAM,kBAAkB,UAAU,MAAM;AACxC,cAAU,oBAAoB,KAAK,UAAU,eAAe,CAAC,EAAE;AAC/D,QAAI,oBAAoB,MAAM;AAC5B,YAAM,2CAA2C;AACjD,aAAO,EAAC,OAAO,OAAO,OAAO,OAAO,QAAQ,OAAO,EAAE,EAAC;AAAA,IACxD;AACA,UAAM,wCAAwC;AAC9C,WAAO,EAAC,OAAO,MAAM,OAAO,gBAAgB,OAAM;AAAA,EACpD;AAEA,QAAM,EAAC,SAAS,QAAO,IAAI,gBAAgB,EAAC,YAAY,iBAAiB,SAAS,UAAU,eAAe,CAAC,KAAK,GAAG,GAAG,8BAA8B,CAAC,GAAG,GAAG,gCAAgC,CAAC,GAAG,GAAG,uBAAsB,CAAC;AAC1N,SAAO,EAAC,SAAS,SAAS,MAAM,gBAAe;AACjD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,51 +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
|
-
var _default = () => {
|
|
37
|
-
const {
|
|
38
|
-
extract,
|
|
39
|
-
compare
|
|
40
|
-
} = (0, _standardIdentifierFactory.default)({
|
|
41
|
-
pattern: /^022$/u,
|
|
42
|
-
subfieldCodes: ['a', 'z', 'y']
|
|
43
|
-
});
|
|
44
|
-
return {
|
|
45
|
-
extract,
|
|
46
|
-
compare,
|
|
47
|
-
name: 'ISSN'
|
|
48
|
-
};
|
|
1
|
+
import createInterface from "./standard-identifier-factory.js";
|
|
2
|
+
export default () => {
|
|
3
|
+
const { extract, compare } = createInterface({ pattern: /^022$/u, subfieldCodes: ["a", "z", "y"] });
|
|
4
|
+
return { extract, compare, name: "ISSN" };
|
|
49
5
|
};
|
|
50
|
-
|
|
51
|
-
//# sourceMappingURL=issn.js.map
|
|
6
|
+
//# sourceMappingURL=issn.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/match-detection/features/bib/issn.js"],
|
|
4
|
+
"sourcesContent": ["\nimport createInterface from './standard-identifier-factory.js';\n\nexport default () => {\n const {extract, compare} = createInterface({pattern: /^022$/u, subfieldCodes: ['a', 'z', 'y']});\n return {extract, compare, name: 'ISSN'};\n};\n"],
|
|
5
|
+
"mappings": "AACA,OAAO,qBAAqB;AAE5B,eAAe,MAAM;AACnB,QAAM,EAAC,SAAS,QAAO,IAAI,gBAAgB,EAAC,SAAS,UAAU,eAAe,CAAC,KAAK,KAAK,GAAG,EAAC,CAAC;AAC9F,SAAO,EAAC,SAAS,SAAS,MAAM,OAAM;AACxC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|