@natlibfi/melinda-record-matching 4.3.2 → 4.3.3-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 +2 -2
- package/LICENSE.txt +21 -165
- package/README.md +1 -1
- package/dist/candidate-search/candidate-search-utils.js +0 -28
- package/dist/candidate-search/candidate-search-utils.js.map +1 -1
- package/dist/candidate-search/choose-queries.js +1 -29
- package/dist/candidate-search/choose-queries.js.map +1 -1
- package/dist/candidate-search/index.js +1 -29
- package/dist/candidate-search/index.js.map +1 -1
- package/dist/candidate-search/index.spec.js +1 -29
- package/dist/candidate-search/index.spec.js.map +1 -1
- package/dist/candidate-search/query-list/bib.js +0 -28
- package/dist/candidate-search/query-list/bib.js.map +1 -1
- package/dist/candidate-search/query-list/bib.spec.js +1 -29
- package/dist/candidate-search/query-list/bib.spec.js.map +1 -1
- package/dist/candidate-search/query-list/index.js +1 -29
- package/dist/candidate-search/query-list/index.js.map +1 -1
- package/dist/index.js +1 -28
- package/dist/index.js.map +1 -1
- package/dist/index.spec.js +1 -29
- package/dist/index.spec.js.map +1 -1
- package/dist/match-detection/features/bib/all-source-ids.js +0 -28
- package/dist/match-detection/features/bib/all-source-ids.js.map +1 -1
- package/dist/match-detection/features/bib/authors.js +0 -27
- package/dist/match-detection/features/bib/authors.js.map +1 -1
- package/dist/match-detection/features/bib/bibliographic-level.js +0 -27
- package/dist/match-detection/features/bib/bibliographic-level.js.map +1 -1
- package/dist/match-detection/features/bib/host-component.js +0 -27
- package/dist/match-detection/features/bib/host-component.js.map +1 -1
- package/dist/match-detection/features/bib/index.js.map +1 -1
- package/dist/match-detection/features/bib/index.spec.js +1 -29
- package/dist/match-detection/features/bib/index.spec.js.map +1 -1
- package/dist/match-detection/features/bib/isbn.js +0 -28
- package/dist/match-detection/features/bib/isbn.js.map +1 -1
- package/dist/match-detection/features/bib/issn.js +0 -27
- package/dist/match-detection/features/bib/issn.js.map +1 -1
- package/dist/match-detection/features/bib/language.js +0 -28
- package/dist/match-detection/features/bib/language.js.map +1 -1
- package/dist/match-detection/features/bib/media-type.js +0 -27
- package/dist/match-detection/features/bib/media-type.js.map +1 -1
- package/dist/match-detection/features/bib/melinda-id.js +0 -27
- package/dist/match-detection/features/bib/melinda-id.js.map +1 -1
- package/dist/match-detection/features/bib/melinda-identifier-factory.js +0 -27
- package/dist/match-detection/features/bib/melinda-identifier-factory.js.map +1 -1
- package/dist/match-detection/features/bib/other-standard-identifier.js +0 -27
- package/dist/match-detection/features/bib/other-standard-identifier.js.map +1 -1
- package/dist/match-detection/features/bib/publication-time-allow-cons-years-multi.js +0 -27
- package/dist/match-detection/features/bib/publication-time-allow-cons-years-multi.js.map +1 -1
- package/dist/match-detection/features/bib/publication-time-allow-cons-years.js +0 -27
- package/dist/match-detection/features/bib/publication-time-allow-cons-years.js.map +1 -1
- package/dist/match-detection/features/bib/publication-time.js +0 -27
- package/dist/match-detection/features/bib/publication-time.js.map +1 -1
- package/dist/match-detection/features/bib/record-type.js +0 -27
- package/dist/match-detection/features/bib/record-type.js.map +1 -1
- package/dist/match-detection/features/bib/standard-identifier-factory.js +0 -27
- package/dist/match-detection/features/bib/standard-identifier-factory.js.map +1 -1
- package/dist/match-detection/features/bib/title-version-original.js +0 -27
- package/dist/match-detection/features/bib/title-version-original.js.map +1 -1
- package/dist/match-detection/features/bib/title.js +0 -28
- package/dist/match-detection/features/bib/title.js.map +1 -1
- package/dist/match-detection/features/index.js +1 -1
- package/dist/match-detection/features/index.js.map +1 -1
- package/dist/match-detection/index.js +1 -28
- package/dist/match-detection/index.js.map +1 -1
- package/dist/match-detection/index.spec.js +1 -29
- package/dist/match-detection/index.spec.js.map +1 -1
- package/dist/matching-utils.js +0 -28
- package/dist/matching-utils.js.map +1 -1
- package/package.json +18 -18
- package/src/candidate-search/candidate-search-utils.js +0 -28
- package/src/candidate-search/choose-queries.js +0 -28
- package/src/candidate-search/index.js +0 -28
- package/src/candidate-search/index.spec.js +0 -28
- package/src/candidate-search/query-list/bib.js +0 -28
- package/src/candidate-search/query-list/bib.spec.js +0 -28
- package/src/candidate-search/query-list/index.js +1 -27
- package/src/index.js +0 -28
- package/src/index.spec.js +0 -28
- package/src/match-detection/features/bib/all-source-ids.js +0 -27
- package/src/match-detection/features/bib/authors.js +1 -27
- 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 +0 -27
- package/src/match-detection/features/bib/index.spec.js +0 -27
- package/src/match-detection/features/bib/isbn.js +0 -27
- package/src/match-detection/features/bib/issn.js +0 -27
- package/src/match-detection/features/bib/language.js +0 -27
- package/src/match-detection/features/bib/media-type.js +1 -27
- package/src/match-detection/features/bib/melinda-id.js +0 -27
- package/src/match-detection/features/bib/melinda-identifier-factory.js +0 -27
- package/src/match-detection/features/bib/other-standard-identifier.js +0 -27
- package/src/match-detection/features/bib/publication-time-allow-cons-years-multi.js +0 -27
- package/src/match-detection/features/bib/publication-time-allow-cons-years.js +0 -27
- package/src/match-detection/features/bib/publication-time.js +1 -27
- package/src/match-detection/features/bib/record-type.js +0 -27
- package/src/match-detection/features/bib/standard-identifier-factory.js +1 -27
- package/src/match-detection/features/bib/title-version-original.js +0 -27
- package/src/match-detection/features/bib/title.js +0 -29
- package/src/match-detection/features/index.js +0 -27
- package/src/match-detection/index.js +0 -27
- package/src/match-detection/index.spec.js +0 -27
- package/src/matching-utils.js +0 -28
|
@@ -7,33 +7,6 @@ exports.default = void 0;
|
|
|
7
7
|
var _debug = _interopRequireDefault(require("debug"));
|
|
8
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
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
10
|
|
|
38
11
|
const debug = (0, _debug.default)('@natlibfi/melinda-record-matching:match-detection:features:media-type');
|
|
39
12
|
const debugData = debug.extend('data');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media-type.js","names":["_debug","_interopRequireDefault","require","obj","__esModule","default","debug","createDebugLogger","debugData","extend","_default","name","extract","record","recordExternal","label","JSON","stringify","values337","get337Values","get","filter","f","subfields","some","subfield","code","value","map","flat","compare","a","b","every","elem","includes","exports"],"sources":["../../../../src/match-detection/features/bib/media-type.js"],"sourcesContent":["/* eslint-disable max-statements */\n
|
|
1
|
+
{"version":3,"file":"media-type.js","names":["_debug","_interopRequireDefault","require","obj","__esModule","default","debug","createDebugLogger","debugData","extend","_default","name","extract","record","recordExternal","label","JSON","stringify","values337","get337Values","get","filter","f","subfields","some","subfield","code","value","map","flat","compare","a","b","every","elem","includes","exports"],"sources":["../../../../src/match-detection/features/bib/media-type.js"],"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"],"mappings":";;;;;;AAGA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAsC,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAHtC;;AAKA,MAAMG,KAAK,GAAG,IAAAC,cAAiB,EAAC,uEAAuE,CAAC;AACxG,MAAMC,SAAS,GAAGF,KAAK,CAACG,MAAM,CAAC,MAAM,CAAC;AAAC,IAAAC,QAAA,GAExBA,CAAA,MAAO;EACpBC,IAAI,EAAE,YAAY;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Q,CAACD,IAAI,CAAC,CAAC,EAAE;MACrC5B,KAAK,CAAE,gCAA+B,CAAC;MACvC,OAAO,CAAC;IACV;IAEA,IAAI0B,CAAC,CAACC,KAAK,CAACC,IAAI,IAAIH,CAAC,CAACI,QAAQ,CAACD,IAAI,CAAC,CAAC,EAAE;MACrC5B,KAAK,CAAE,gCAA+B,CAAC;MACvC,OAAO,CAAC;IACV;IAEAA,KAAK,CAAE,wCAAuC,CAAC;IAC/C,OAAO,CAAC,CAAC;EAEX;AACF,CAAC,CAAC;AAAA8B,OAAA,CAAA/B,OAAA,GAAAK,QAAA","ignoreList":[]}
|
|
@@ -6,33 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _melindaIdentifierFactory = _interopRequireDefault(require("./melinda-identifier-factory"));
|
|
8
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
9
|
var _default = () => {
|
|
37
10
|
const {
|
|
38
11
|
extract,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"melinda-id.js","names":["_melindaIdentifierFactory","_interopRequireDefault","require","obj","__esModule","default","_default","extract","compare","createInterface","name","exports"],"sources":["../../../../src/match-detection/features/bib/melinda-id.js"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"melinda-id.js","names":["_melindaIdentifierFactory","_interopRequireDefault","require","obj","__esModule","default","_default","extract","compare","createInterface","name","exports"],"sources":["../../../../src/match-detection/features/bib/melinda-id.js"],"sourcesContent":["\nimport createInterface from './melinda-identifier-factory';\n\nexport default () => {\n const {extract, compare} = createInterface();\n return {extract, compare, name: 'melinda-id'};\n};\n"],"mappings":";;;;;;AACA,IAAAA,yBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA2D,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,IAAAG,QAAA,GAE5CA,CAAA,KAAM;EACnB,MAAM;IAACC,OAAO;IAAEC;EAAO,CAAC,GAAG,IAAAC,iCAAe,EAAC,CAAC;EAC5C,OAAO;IAACF,OAAO;IAAEC,OAAO;IAAEE,IAAI,EAAE;EAAY,CAAC;AAC/C,CAAC;AAAAC,OAAA,CAAAN,OAAA,GAAAC,QAAA","ignoreList":[]}
|
|
@@ -7,33 +7,6 @@ exports.default = void 0;
|
|
|
7
7
|
var _debug = _interopRequireDefault(require("debug"));
|
|
8
8
|
var _matchingUtils = require("../../../matching-utils");
|
|
9
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
10
|
// 003+001 FI-MELINDA <melinda-id>
|
|
38
11
|
// 035 $a (FI-MELINDA)<melinda-id>
|
|
39
12
|
// 035 $z (FI-MELINDA)<melinda-id>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"melinda-identifier-factory.js","names":["_debug","_interopRequireDefault","require","_matchingUtils","obj","__esModule","default","_default","debug","createDebugLogger","debugData","extend","extract","compare","record","recordExternal","isMelindaRecord","get","some","f003","value","f001","map","field","f035MelindaIds","getMelindaIdsF035","undefined","length","label","a","b","id","JSON","stringify","idA","idB","exports"],"sources":["../../../../src/match-detection/features/bib/melinda-identifier-factory.js"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"melinda-identifier-factory.js","names":["_debug","_interopRequireDefault","require","_matchingUtils","obj","__esModule","default","_default","debug","createDebugLogger","debugData","extend","extract","compare","record","recordExternal","isMelindaRecord","get","some","f003","value","f001","map","field","f035MelindaIds","getMelindaIdsF035","undefined","length","label","a","b","id","JSON","stringify","idA","idB","exports"],"sources":["../../../../src/match-detection/features/bib/melinda-identifier-factory.js"],"sourcesContent":["\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, 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"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAA0D,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAE1D;AACA;AACA;AACA;AACA;AACA;AAAA,IAAAG,QAAA,GAEeA,CAAA,KAAM;EAEnB,MAAMC,KAAK,GAAG,IAAAC,cAAiB,EAAC,2EAA2E,CAAC;EAC5G,MAAMC,SAAS,GAAGF,KAAK,CAACG,MAAM,CAAC,MAAM,CAAC;EAEtC,OAAO;IAACC,OAAO;IAAEC;EAAO,CAAC;EAEzB,SAASD,OAAOA,CAAC;IAACE,MAAM;IAAEC;EAAc,CAAC,EAAE;IAEzC,MAAMC,eAAe,GAAGF,MAAM,CAACG,GAAG,CAAC,KAAK,CAAC,CAACC,IAAI,CAACC,IAAI,IAAIA,IAAI,CAACC,KAAK,KAAK,YAAY,CAAC;IACnF,MAAM,CAACC,IAAI,CAAC,GAAGP,MAAM,CAACG,GAAG,CAAC,KAAK,CAAC,CAACK,GAAG,CAACC,KAAK,IAAIA,KAAK,CAACH,KAAK,CAAC;IAC1D,MAAMI,cAAc,GAAG,IAAAC,gCAAiB,EAACX,MAAM,CAAC;IAEhD,IACEE,eAAe,KAAKU,SAAS,IAC7BL,IAAI,KAAKK,SAAS,IAClBF,cAAc,CAACG,MAAM,GAAG,CAAC,EAAE;MAE3BnB,KAAK,CAAE,GAAEO,cAAc,CAACa,KAAM,uBAAsB,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G,CAAC,CAAC,EAAE;MAC5ExB,SAAS,CAAE,iBAAgBsB,IAAI,CAACC,SAAS,CAACJ,CAAC,CAACL,cAAc,CAAE,0BAAyBQ,IAAI,CAACC,SAAS,CAACH,CAAC,CAACN,cAAc,CAAE,EAAC,CAAC;MACxH,OAAO,CAAC;IACV;IACAhB,KAAK,CAAE,0BAAyB,CAAC;IACjC,OAAO,CAAC;EACV;AACF,CAAC;AAAA4B,OAAA,CAAA9B,OAAA,GAAAC,QAAA","ignoreList":[]}
|
|
@@ -6,33 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _standardIdentifierFactory = _interopRequireDefault(require("./standard-identifier-factory"));
|
|
8
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
9
|
// DEVELOP: we should compare indicators and sf2 for f024
|
|
37
10
|
var _default = () => {
|
|
38
11
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"other-standard-identifier.js","names":["_standardIdentifierFactory","_interopRequireDefault","require","obj","__esModule","default","_default","extract","compare","createInterface","pattern","subfieldCodes","name","exports"],"sources":["../../../../src/match-detection/features/bib/other-standard-identifier.js"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"other-standard-identifier.js","names":["_standardIdentifierFactory","_interopRequireDefault","require","obj","__esModule","default","_default","extract","compare","createInterface","pattern","subfieldCodes","name","exports"],"sources":["../../../../src/match-detection/features/bib/other-standard-identifier.js"],"sourcesContent":["\nimport createInterface from './standard-identifier-factory';\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"],"mappings":";;;;;;AACA,IAAAA,0BAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA4D,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAE5D;AAAA,IAAAG,QAAA,GAEeA,CAAA,KAAM;EACnB,MAAM;IAACC,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;AAAAC,OAAA,CAAAR,OAAA,GAAAC,QAAA","ignoreList":[]}
|
|
@@ -7,33 +7,6 @@ exports.default = void 0;
|
|
|
7
7
|
var _matchingUtils = require("../../../matching-utils");
|
|
8
8
|
var _debug = _interopRequireDefault(require("debug"));
|
|
9
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
10
|
// We should also get copyright time and copyright/publication times from 26x
|
|
38
11
|
// We should also get publishing time type from f008
|
|
39
12
|
// We should get reprint times from f500 $a "Lisäpainos/Lisäpainokset:"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publication-time-allow-cons-years-multi.js","names":["_matchingUtils","require","_debug","_interopRequireDefault","obj","__esModule","default","_default","name","extract","record","recordExternal","debug","createDebugLogger","label","f008Values","extractF008Values","JSON","stringify","f26xValues","extractF26xValues","f500Values","extractF500Years","normalYears","Set","concat","f008Date1","filter","value","sort","copyrightYears","reprintYears","combined","get","undefined","testStringOrNumber","extractF008Date1","f008Date2","extractF008Date2","f008YearType","extractF008YearType","String","slice","copyrightRegex","pubNormalSubFieldValues","extractPubNormalSubfieldValues","pubF264CopySubFieldValues","extractPubF264CopySubfieldValues","pubF260CopySubFieldValues","extractPubF260CopySubfieldValues","field","tag","ind2","map","subfields","flat","code","test","removeNonAlphaNumeric","replace","nonAlphaNumericRegex","reprintRegex","reprintFieldContents","filteredF500","content","match","extractReprintYears","contents","yearRegex","years","uniqYears","compare","a","b","firstA","firstB","firstANumber","parseInt","firstBNumber","isNaN","bNormalInANormal","aValue","some","bValue","aNormalInBNormal","bNormalInAReprint","aNormalInBReprint","exports"],"sources":["../../../../src/match-detection/features/bib/publication-time-allow-cons-years-multi.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-2023 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';\nimport createDebugLogger from 'debug';\n\n// We should also get copyright time and copyright/publication times from 26x\n// We should also get publishing time type from f008\n// We should get reprint times from f500 $a \"Lisäpainos/Lisäpainokset:\"\n\nexport default () => ({\n name: 'Publication time, allow consequent years, years from multiple sources',\n extract: ({record, recordExternal}) => {\n const debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features/bib/publication-time-allow-cons-years-multi');\n const label = recordExternal && recordExternal.label ? recordExternal.label : 'record';\n\n const f008Values = extractF008Values(record);\n debug(`${label} f008: ${JSON.stringify(f008Values)}`);\n\n const f26xValues = extractF26xValues(record);\n debug(`${label} f26x: ${JSON.stringify(f26xValues)}`);\n\n const f500Values = extractF500Years(record);\n debug(`${label} f500: ${JSON.stringify(f500Values)}`);\n\n // We should get copyrightYear from f008Date2 to copyrightYears when f008YearType = 'r'\n // Is the original year (f008Date2) in f008YearType === 'r' comparable to copyrightYear?\n // We should handle unknown years (here or comparison?)\n // We should handle year ranges for continuing resources / collections\n\n const normalYears = [...new Set(f26xValues.normalYears.concat(f008Values.f008Date1).filter(value => value && value !== ' ' && value !== '||||'))].sort();\n const copyrightYears = [...new Set(f26xValues.copyrightYears)].sort();\n const reprintYears = [...new Set(f500Values)].sort();\n\n const combined = {normalYears, copyrightYears, reprintYears};\n\n debug(`Combined: ${JSON.stringify(combined)}`);\n\n return combined;\n\n function extractF008Values(record) {\n // Record should have only one f008 - in case of several, we handle the first one\n const value = record.get(/^008$/u)?.[0]?.value || undefined;\n if (value && testStringOrNumber(value)) {\n const f008Date1 = extractF008Date1(value);\n const f008Date2 = extractF008Date2(value);\n const f008YearType = extractF008YearType(value);\n return {f008Date1, f008Date2, f008YearType};\n }\n return {f008Date1: undefined, f008Date2: undefined, f008YearType: undefined};\n\n function extractF008Date1(value) {\n return String(value).slice(7, 11);\n }\n\n function extractF008Date2(value) {\n return String(value).slice(11, 15);\n }\n\n function extractF008YearType(value) {\n return String(value).slice(6, 7);\n }\n }\n\n function extractF26xValues(record) {\n const copyrightRegex = /^(?<copyrightPrefix>cop|cop.|c|©|p|℗)/u;\n\n const pubNormalSubFieldValues = extractPubNormalSubfieldValues(record, copyrightRegex);\n debug(`Normal years: ${JSON.stringify(pubNormalSubFieldValues)}`);\n\n const pubF264CopySubFieldValues = extractPubF264CopySubfieldValues(record);\n debug(`F264 copyright years: ${JSON.stringify(pubF264CopySubFieldValues)}`);\n\n const pubF260CopySubFieldValues = extractPubF260CopySubfieldValues(record, copyrightRegex);\n debug(`F260 copyright years: ${JSON.stringify(pubF260CopySubFieldValues)}`);\n\n return {normalYears: pubNormalSubFieldValues, copyrightYears: [...pubF260CopySubFieldValues, ...pubF264CopySubFieldValues]};\n\n function extractPubNormalSubfieldValues(record, copyrightRegex) {\n return record.get(/^26[04]$/u)\n .filter((field) => !(field.tag === '264' && field.ind2 === '4'))\n .map(({subfields}) => subfields)\n .flat()\n .filter(({code}) => code && code === 'c')\n .filter(({value}) => value && !copyrightRegex.test(value))\n .map(({value}) => value)\n .map((value) => removeNonAlphaNumeric(value));\n }\n\n function extractPubF264CopySubfieldValues(record, copyrightRegex) {\n return record.get(/^264$/u)\n .filter((field) => field.ind2 === '4')\n .map(({subfields}) => subfields)\n .flat()\n .filter(({code}) => code && code === 'c')\n .filter(({value}) => value)\n .map(({value}) => value)\n .map((value) => value.replace(copyrightRegex, ''))\n .map((value) => removeNonAlphaNumeric(value));\n }\n\n function extractPubF260CopySubfieldValues(record, copyrightRegex) {\n return record.get(/^260$/u)\n .map(({subfields}) => subfields)\n .flat()\n .filter(({code}) => code && code === 'c')\n .filter(({value}) => value && copyrightRegex.test(value))\n .map(({value}) => value)\n .map((value) => value.replace(copyrightRegex, ''))\n .map((value) => removeNonAlphaNumeric(value));\n }\n\n function removeNonAlphaNumeric(value) {\n debug(`Cleaning: ${JSON.stringify(value)}`);\n const nonAlphaNumericRegex = /[^A-Za-z0-9]/ug;\n return value ? value.replace(nonAlphaNumericRegex, '') : value;\n }\n }\n\n function extractF500Years(record) {\n\n const reprintRegex = /(?<reprint>Lisäpainokset:|Lisäpainos:)/u;\n const reprintFieldContents = record.get(/^500$/u)\n .map(({subfields}) => subfields)\n .flat()\n .filter(({code}) => code === 'a')\n .map(({value}) => value);\n //.filter(value => value.test(reprintRegex));\n\n debug(`f500 reprint field contents: ${JSON.stringify(reprintFieldContents)}`);\n\n const filteredF500 = reprintFieldContents.filter((content) => content && content.match(reprintRegex));\n\n debug(`f500 reprint field contents (filtered): ${JSON.stringify(filteredF500)}`);\n\n const reprintYears = extractReprintYears(filteredF500);\n\n return reprintYears;\n }\n\n function extractReprintYears(contents) {\n const yearRegex = /[0-9][0-9][0-9][0-9]/gu;\n const years = contents.map(content => content.match(yearRegex))\n .flat();\n debug(`${JSON.stringify(years)}`);\n const uniqYears = [...new Set(years)].sort();\n debug(`${JSON.stringify(uniqYears)}`);\n return uniqYears;\n }\n\n },\n // eslint-disable-next-line max-statements\n compare: (a, b) => {\n const debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features/bib/publication-time-allow-cons-years-multi');\n debug(`Comparing ${JSON.stringify(a)} to ${JSON.stringify(b)}`);\n\n const [firstA] = a.normalYears ? a.normalYears : a;\n const [firstB] = b.normalYears ? b.normalYears : b;\n\n debug(`Comparing ${JSON.stringify(firstA)} to ${JSON.stringify(firstB)}`);\n\n if (firstA === firstB) {\n return 0.1;\n }\n\n // If either of years is a non string/number, values are not comparable\n if (!testStringOrNumber(firstA) || !testStringOrNumber(firstB)) {\n return 0;\n }\n\n const firstANumber = parseInt(firstA, 10);\n const firstBNumber = parseInt(firstB, 10);\n\n // Handle consequent years as a match\n // see publication-time for a version that does not handle consequent years as a match\n if (!(isNaN(firstANumber) || isNaN(firstBNumber)) &&\n (firstANumber + 1 === firstBNumber || firstANumber - 1 === firstBNumber)) {\n return 0.1;\n }\n\n // We should do something with copyrightYears, too\n\n // Do not give minus points if a normal publishing year is found in normal years\n const bNormalInANormal = a.normalYears.filter(aValue => b.normalYears.some(bValue => aValue === bValue));\n const aNormalInBNormal = b.normalYears.filter(bValue => a.normalYears.some(aValue => bValue === aValue));\n debug(`BNorm in ANorm: ${JSON.stringify(bNormalInANormal)}`);\n debug(`ANorm in BNorm: ${JSON.stringify(aNormalInBNormal)}`);\n\n if (bNormalInANormal > 0 || aNormalInBNormal > 0) {\n return 0;\n }\n\n // Do not give minus points if a normal publishing year is found in reprint years\n const bNormalInAReprint = a.reprintYears.filter(aValue => b.normalYears.some(bValue => aValue === bValue));\n const aNormalInBReprint = b.reprintYears.filter(bValue => a.normalYears.some(aValue => bValue === aValue));\n debug(`BNorm in AReprint: ${JSON.stringify(bNormalInAReprint)}`);\n debug(`ANorm in BReprint: ${JSON.stringify(aNormalInBReprint)}`);\n\n if (bNormalInAReprint > 0 || aNormalInBReprint > 0) {\n return 0;\n }\n\n return -1;\n\n }\n});\n\n// https://www.loc.gov/marc/bibliographic/bd008.html\n// field 008\n// 06 - Type of date/Publication status\n// 07-10 - Date 1\n// 11-14 - Date 2\n//\n// 06 - Type of date/Publication status\n// b - No dates given; B.C. date involved\n// c - Continuing resource currently published\n// d - Continuing resource ceased publication\n// e - Detailed date\n// i - Inclusive dates of collection\n// k - Range of years of bulk of collection\n// m - Multiple dates\n// n - Dates unknown\n// p - Date of distribution/release/issue and production/recording session when different\n// q - Questionable date\n// r - Reprint/reissue date and original date\n// s - Single known date/probable date\n// t - Publication date and copyright date\n// u - Continuing resource status unknown\n// | - No attempt to code\n//\n// 07-10 - Date 1\n// 1-9 - Date digit\n// # - Date element is not applicable\n// u - Date element is totally or partially unknown\n// |||| - No attempt to code\n//\n// 11-14 - Date 2\n// 1-9 - Date digit\n// # - Date element is not applicable\n// u - Date element is totally or partially unknown\n// |||| - No attempt to code\n//\n\n"],"mappings":";;;;;;AA4BA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAsC,SAAAE,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;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;AA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CAAE,EAAC,CAAC;IAEhE,IAAID,iBAAiB,GAAG,CAAC,IAAIC,iBAAiB,GAAG,CAAC,EAAE;MAClD,OAAO,CAAC;IACV;IAEA,OAAO,CAAC,CAAC;EAEX;AACF,CAAC,CAAC,EAEF;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAAC,OAAA,CAAAjF,OAAA,GAAAC,QAAA"}
|
|
1
|
+
{"version":3,"file":"publication-time-allow-cons-years-multi.js","names":["_matchingUtils","require","_debug","_interopRequireDefault","obj","__esModule","default","_default","name","extract","record","recordExternal","debug","createDebugLogger","label","f008Values","extractF008Values","JSON","stringify","f26xValues","extractF26xValues","f500Values","extractF500Years","normalYears","Set","concat","f008Date1","filter","value","sort","copyrightYears","reprintYears","combined","get","undefined","testStringOrNumber","extractF008Date1","f008Date2","extractF008Date2","f008YearType","extractF008YearType","String","slice","copyrightRegex","pubNormalSubFieldValues","extractPubNormalSubfieldValues","pubF264CopySubFieldValues","extractPubF264CopySubfieldValues","pubF260CopySubFieldValues","extractPubF260CopySubfieldValues","field","tag","ind2","map","subfields","flat","code","test","removeNonAlphaNumeric","replace","nonAlphaNumericRegex","reprintRegex","reprintFieldContents","filteredF500","content","match","extractReprintYears","contents","yearRegex","years","uniqYears","compare","a","b","firstA","firstB","firstANumber","parseInt","firstBNumber","isNaN","bNormalInANormal","aValue","some","bValue","aNormalInBNormal","bNormalInAReprint","aNormalInBReprint","exports"],"sources":["../../../../src/match-detection/features/bib/publication-time-allow-cons-years-multi.js"],"sourcesContent":["\nimport {testStringOrNumber} from '../../../matching-utils';\nimport createDebugLogger from 'debug';\n\n// We should also get copyright time and copyright/publication times from 26x\n// We should also get publishing time type from f008\n// We should get reprint times from f500 $a \"Lisäpainos/Lisäpainokset:\"\n\nexport default () => ({\n name: 'Publication time, allow consequent years, years from multiple sources',\n extract: ({record, recordExternal}) => {\n const debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features/bib/publication-time-allow-cons-years-multi');\n const label = recordExternal && recordExternal.label ? recordExternal.label : 'record';\n\n const f008Values = extractF008Values(record);\n debug(`${label} f008: ${JSON.stringify(f008Values)}`);\n\n const f26xValues = extractF26xValues(record);\n debug(`${label} f26x: ${JSON.stringify(f26xValues)}`);\n\n const f500Values = extractF500Years(record);\n debug(`${label} f500: ${JSON.stringify(f500Values)}`);\n\n // We should get copyrightYear from f008Date2 to copyrightYears when f008YearType = 'r'\n // Is the original year (f008Date2) in f008YearType === 'r' comparable to copyrightYear?\n // We should handle unknown years (here or comparison?)\n // We should handle year ranges for continuing resources / collections\n\n const normalYears = [...new Set(f26xValues.normalYears.concat(f008Values.f008Date1).filter(value => value && value !== ' ' && value !== '||||'))].sort();\n const copyrightYears = [...new Set(f26xValues.copyrightYears)].sort();\n const reprintYears = [...new Set(f500Values)].sort();\n\n const combined = {normalYears, copyrightYears, reprintYears};\n\n debug(`Combined: ${JSON.stringify(combined)}`);\n\n return combined;\n\n function extractF008Values(record) {\n // Record should have only one f008 - in case of several, we handle the first one\n const value = record.get(/^008$/u)?.[0]?.value || undefined;\n if (value && testStringOrNumber(value)) {\n const f008Date1 = extractF008Date1(value);\n const f008Date2 = extractF008Date2(value);\n const f008YearType = extractF008YearType(value);\n return {f008Date1, f008Date2, f008YearType};\n }\n return {f008Date1: undefined, f008Date2: undefined, f008YearType: undefined};\n\n function extractF008Date1(value) {\n return String(value).slice(7, 11);\n }\n\n function extractF008Date2(value) {\n return String(value).slice(11, 15);\n }\n\n function extractF008YearType(value) {\n return String(value).slice(6, 7);\n }\n }\n\n function extractF26xValues(record) {\n const copyrightRegex = /^(?<copyrightPrefix>cop|cop.|c|©|p|℗)/u;\n\n const pubNormalSubFieldValues = extractPubNormalSubfieldValues(record, copyrightRegex);\n debug(`Normal years: ${JSON.stringify(pubNormalSubFieldValues)}`);\n\n const pubF264CopySubFieldValues = extractPubF264CopySubfieldValues(record);\n debug(`F264 copyright years: ${JSON.stringify(pubF264CopySubFieldValues)}`);\n\n const pubF260CopySubFieldValues = extractPubF260CopySubfieldValues(record, copyrightRegex);\n debug(`F260 copyright years: ${JSON.stringify(pubF260CopySubFieldValues)}`);\n\n return {normalYears: pubNormalSubFieldValues, copyrightYears: [...pubF260CopySubFieldValues, ...pubF264CopySubFieldValues]};\n\n function extractPubNormalSubfieldValues(record, copyrightRegex) {\n return record.get(/^26[04]$/u)\n .filter((field) => !(field.tag === '264' && field.ind2 === '4'))\n .map(({subfields}) => subfields)\n .flat()\n .filter(({code}) => code && code === 'c')\n .filter(({value}) => value && !copyrightRegex.test(value))\n .map(({value}) => value)\n .map((value) => removeNonAlphaNumeric(value));\n }\n\n function extractPubF264CopySubfieldValues(record, copyrightRegex) {\n return record.get(/^264$/u)\n .filter((field) => field.ind2 === '4')\n .map(({subfields}) => subfields)\n .flat()\n .filter(({code}) => code && code === 'c')\n .filter(({value}) => value)\n .map(({value}) => value)\n .map((value) => value.replace(copyrightRegex, ''))\n .map((value) => removeNonAlphaNumeric(value));\n }\n\n function extractPubF260CopySubfieldValues(record, copyrightRegex) {\n return record.get(/^260$/u)\n .map(({subfields}) => subfields)\n .flat()\n .filter(({code}) => code && code === 'c')\n .filter(({value}) => value && copyrightRegex.test(value))\n .map(({value}) => value)\n .map((value) => value.replace(copyrightRegex, ''))\n .map((value) => removeNonAlphaNumeric(value));\n }\n\n function removeNonAlphaNumeric(value) {\n debug(`Cleaning: ${JSON.stringify(value)}`);\n const nonAlphaNumericRegex = /[^A-Za-z0-9]/ug;\n return value ? value.replace(nonAlphaNumericRegex, '') : value;\n }\n }\n\n function extractF500Years(record) {\n\n const reprintRegex = /(?<reprint>Lisäpainokset:|Lisäpainos:)/u;\n const reprintFieldContents = record.get(/^500$/u)\n .map(({subfields}) => subfields)\n .flat()\n .filter(({code}) => code === 'a')\n .map(({value}) => value);\n //.filter(value => value.test(reprintRegex));\n\n debug(`f500 reprint field contents: ${JSON.stringify(reprintFieldContents)}`);\n\n const filteredF500 = reprintFieldContents.filter((content) => content && content.match(reprintRegex));\n\n debug(`f500 reprint field contents (filtered): ${JSON.stringify(filteredF500)}`);\n\n const reprintYears = extractReprintYears(filteredF500);\n\n return reprintYears;\n }\n\n function extractReprintYears(contents) {\n const yearRegex = /[0-9][0-9][0-9][0-9]/gu;\n const years = contents.map(content => content.match(yearRegex))\n .flat();\n debug(`${JSON.stringify(years)}`);\n const uniqYears = [...new Set(years)].sort();\n debug(`${JSON.stringify(uniqYears)}`);\n return uniqYears;\n }\n\n },\n // eslint-disable-next-line max-statements\n compare: (a, b) => {\n const debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features/bib/publication-time-allow-cons-years-multi');\n debug(`Comparing ${JSON.stringify(a)} to ${JSON.stringify(b)}`);\n\n const [firstA] = a.normalYears ? a.normalYears : a;\n const [firstB] = b.normalYears ? b.normalYears : b;\n\n debug(`Comparing ${JSON.stringify(firstA)} to ${JSON.stringify(firstB)}`);\n\n if (firstA === firstB) {\n return 0.1;\n }\n\n // If either of years is a non string/number, values are not comparable\n if (!testStringOrNumber(firstA) || !testStringOrNumber(firstB)) {\n return 0;\n }\n\n const firstANumber = parseInt(firstA, 10);\n const firstBNumber = parseInt(firstB, 10);\n\n // Handle consequent years as a match\n // see publication-time for a version that does not handle consequent years as a match\n if (!(isNaN(firstANumber) || isNaN(firstBNumber)) &&\n (firstANumber + 1 === firstBNumber || firstANumber - 1 === firstBNumber)) {\n return 0.1;\n }\n\n // We should do something with copyrightYears, too\n\n // Do not give minus points if a normal publishing year is found in normal years\n const bNormalInANormal = a.normalYears.filter(aValue => b.normalYears.some(bValue => aValue === bValue));\n const aNormalInBNormal = b.normalYears.filter(bValue => a.normalYears.some(aValue => bValue === aValue));\n debug(`BNorm in ANorm: ${JSON.stringify(bNormalInANormal)}`);\n debug(`ANorm in BNorm: ${JSON.stringify(aNormalInBNormal)}`);\n\n if (bNormalInANormal > 0 || aNormalInBNormal > 0) {\n return 0;\n }\n\n // Do not give minus points if a normal publishing year is found in reprint years\n const bNormalInAReprint = a.reprintYears.filter(aValue => b.normalYears.some(bValue => aValue === bValue));\n const aNormalInBReprint = b.reprintYears.filter(bValue => a.normalYears.some(aValue => bValue === aValue));\n debug(`BNorm in AReprint: ${JSON.stringify(bNormalInAReprint)}`);\n debug(`ANorm in BReprint: ${JSON.stringify(aNormalInBReprint)}`);\n\n if (bNormalInAReprint > 0 || aNormalInBReprint > 0) {\n return 0;\n }\n\n return -1;\n\n }\n});\n\n// https://www.loc.gov/marc/bibliographic/bd008.html\n// field 008\n// 06 - Type of date/Publication status\n// 07-10 - Date 1\n// 11-14 - Date 2\n//\n// 06 - Type of date/Publication status\n// b - No dates given; B.C. date involved\n// c - Continuing resource currently published\n// d - Continuing resource ceased publication\n// e - Detailed date\n// i - Inclusive dates of collection\n// k - Range of years of bulk of collection\n// m - Multiple dates\n// n - Dates unknown\n// p - Date of distribution/release/issue and production/recording session when different\n// q - Questionable date\n// r - Reprint/reissue date and original date\n// s - Single known date/probable date\n// t - Publication date and copyright date\n// u - Continuing resource status unknown\n// | - No attempt to code\n//\n// 07-10 - Date 1\n// 1-9 - Date digit\n// # - Date element is not applicable\n// u - Date element is totally or partially unknown\n// |||| - No attempt to code\n//\n// 11-14 - Date 2\n// 1-9 - Date digit\n// # - Date element is not applicable\n// u - Date element is totally or partially unknown\n// |||| - No attempt to code\n//\n\n"],"mappings":";;;;;;AACA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAsC,SAAAE,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEtC;AACA;AACA;AAAA,IAAAG,QAAA,GAEeA,CAAA,MAAO;EACpBC,IAAI,EAAE,uEAAuE;EAC7EC,OAAO,E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O,CAAC;IACV;IAEA,OAAO,CAAC,CAAC;EAEX;AACF,CAAC,CAAC,EAEF;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAAC,OAAA,CAAAjF,OAAA,GAAAC,QAAA","ignoreList":[]}
|
|
@@ -7,33 +7,6 @@ exports.default = void 0;
|
|
|
7
7
|
var _matchingUtils = require("../../../matching-utils");
|
|
8
8
|
var _debug = _interopRequireDefault(require("debug"));
|
|
9
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
10
|
// We should also get copyright time and copyright/publication times from 26x
|
|
38
11
|
var _default = () => ({
|
|
39
12
|
name: 'Publication time, allow consequent years',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publication-time-allow-cons-years.js","names":["_matchingUtils","require","_debug","_interopRequireDefault","obj","__esModule","default","_default","name","extract","record","value","get","undefined","testStringOrNumber","String","slice","compare","a","b","debug","createDebugLogger","firstA","firstB","firstANumber","parseInt","firstBNumber","isNaN","exports"],"sources":["../../../../src/match-detection/features/bib/publication-time-allow-cons-years.js"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"publication-time-allow-cons-years.js","names":["_matchingUtils","require","_debug","_interopRequireDefault","obj","__esModule","default","_default","name","extract","record","value","get","undefined","testStringOrNumber","String","slice","compare","a","b","debug","createDebugLogger","firstA","firstB","firstANumber","parseInt","firstBNumber","isNaN","exports"],"sources":["../../../../src/match-detection/features/bib/publication-time-allow-cons-years.js"],"sourcesContent":["\nimport {testStringOrNumber} from '../../../matching-utils';\nimport createDebugLogger from 'debug';\n\n// We should also get copyright time and copyright/publication times from 26x\n\nexport default () => ({\n name: 'Publication time, allow consequent years',\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) => {\n const debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features/bib/publication-time-allow-cons-years');\n debug(`Comparing ${a[0]} to ${b[0]}`);\n\n const [firstA] = a;\n const [firstB] = b;\n\n if (firstA === firstB) {\n return 0.1;\n }\n\n // If either of years is a non string/number, values are not comparable\n if (!testStringOrNumber(firstA) || !testStringOrNumber(firstB)) {\n return 0;\n }\n\n const firstANumber = parseInt(firstA, 10);\n const firstBNumber = parseInt(firstB, 10);\n\n if (isNaN(firstANumber) || isNaN(firstBNumber)) {\n return -1;\n }\n\n // Handle consequent years as a match\n // see publication-time for a version that does not handle consequent years as a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GD,QAAQ,CAACF,MAAM,EAAE,EAAE,CAAC;IAEzC,IAAII,KAAK,CAACH,YAAY,CAAC,IAAIG,KAAK,CAACD,YAAY,CAAC,EAAE;MAC9C,OAAO,CAAC,CAAC;IACX;;IAEA;IACA;IACA,OAAOF,YAAY,GAAG,CAAC,KAAKE,YAAY,IAAIF,YAAY,GAAG,CAAC,KAAKE,YAAY,GAAG,GAAG,GAAG,CAAC,CAAC;EAC1F;AACF,CAAC,CAAC;AAAAE,OAAA,CAAAtB,OAAA,GAAAC,QAAA","ignoreList":[]}
|
|
@@ -5,33 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
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
8
|
// We should also get copyright time and copyright/publication times from 26x
|
|
36
9
|
// see publication-time-allow-cons-years for a version allowing consequent years to match
|
|
37
10
|
var _default = () => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publication-time.js","names":["_matchingUtils","require","_default","name","extract","record","value","get","undefined","testStringOrNumber","String","slice","compare","a","b","exports","default"],"sources":["../../../../src/match-detection/features/bib/publication-time.js"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"publication-time.js","names":["_matchingUtils","require","_default","name","extract","record","value","get","undefined","testStringOrNumber","String","slice","compare","a","b","exports","default"],"sources":["../../../../src/match-detection/features/bib/publication-time.js"],"sourcesContent":["\n\nimport {testStringOrNumber} from '../../../matching-utils';\n\n// We should also get copyright time and copyright/publication times from 26x\n// see publication-time-allow-cons-years for a version allowing consequent years to match\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":";;;;;;AAEA,IAAAA,cAAA,GAAAC,OAAA;AAEA;AACA;AAAA,IAAAC,QAAA,GAEeA,CAAA,MAAO;EACpBC,IAAI,EAAE,kBAAkB;EACxBC,OAAO,EAAEA,CAAC;IAACC;EAAM,CAAC,KAAK;IACrB,MAAMC,KAAK,GAAGD,MAAM,CAACE,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAED,KAAK,IAAIE,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,EAAEA,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAAC,CAAC,CAAC,KAAKC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC;AAC5C,CAAC,CAAC;AAAAC,OAAA,CAAAC,OAAA,GAAAd,QAAA","ignoreList":[]}
|
|
@@ -4,33 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
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
7
|
// we could handle the case of books/notes
|
|
35
8
|
// Recordtype: LDR/06 - Type of Record
|
|
36
9
|
// Note: currently matchValidator fails all mismatching recordTypes, so this won't actually do much
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record-type.js","names":["_default","name","extract","record","leader","compare","a","b","exports","default"],"sources":["../../../../src/match-detection/features/bib/record-type.js"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"record-type.js","names":["_default","name","extract","record","leader","compare","a","b","exports","default"],"sources":["../../../../src/match-detection/features/bib/record-type.js"],"sourcesContent":["\n// we could handle the case of books/notes\n// Recordtype: LDR/06 - Type of Record\n// Note: currently matchValidator fails all mismatching recordTypes, so this won't actually do much\n\nexport default () => ({\n name: 'Record type',\n extract: ({record}) => record.leader[6] ? [record.leader[6]] : [],\n compare: (a, b) => a[0] === b[0] ? 0.1 : -0.5\n});\n"],"mappings":";;;;;;AACA;AACA;AACA;AAAA,IAAAA,QAAA,GAEeA,CAAA,MAAO;EACpBC,IAAI,EAAE,aAAa;EACnBC,OAAO,EAAEA,CAAC;IAACC;EAAM,CAAC,KAAKA,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,GAAG,CAACD,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE;EACjEC,OAAO,EAAEA,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAAC,CAAC,CAAC,KAAKC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC;AAC5C,CAAC,CAAC;AAAAC,OAAA,CAAAC,OAAA,GAAAT,QAAA","ignoreList":[]}
|
|
@@ -8,33 +8,6 @@ var _debug = _interopRequireDefault(require("debug"));
|
|
|
8
8
|
var _matchingUtils = require("../../../matching-utils");
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
10
|
/* eslint-disable max-statements */
|
|
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-2022 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
11
|
// Note about validity of standardIdentifiers:
|
|
39
12
|
// We have three types of invalid standardIdentifiers:
|
|
40
13
|
// 1. Formally invalid standardIdentifiers (ie. typos either in the resource or the record)
|