@natlibfi/melinda-record-matching 4.3.5 → 5.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/.github/workflows/melinda-node-tests.yml +11 -7
  2. package/eslint.config.js +52 -0
  3. package/example.env +4 -0
  4. package/package.json +22 -90
  5. package/src/candidate-search/choose-queries.js +1 -3
  6. package/src/candidate-search/index.js +63 -89
  7. package/src/candidate-search/{index.spec.js → index.test.js} +19 -18
  8. package/src/candidate-search/query-list/bib.js +10 -4
  9. package/src/candidate-search/query-list/{bib.spec.js → bib.test.js} +8 -7
  10. package/src/candidate-search/query-list/component.js +127 -0
  11. package/src/candidate-search/query-list/index.js +23 -9
  12. package/src/cli.js +177 -0
  13. package/src/index.js +22 -37
  14. package/src/{index.spec.js → index.test.js} +11 -14
  15. package/src/match-detection/features/bib/all-source-ids.js +2 -2
  16. package/src/match-detection/features/bib/authors.js +3 -2
  17. package/src/match-detection/features/bib/index.js +16 -16
  18. package/src/match-detection/features/bib/{index.spec.js → index.test.js} +7 -6
  19. package/src/match-detection/features/bib/isbn.js +2 -2
  20. package/src/match-detection/features/bib/issn.js +1 -1
  21. package/src/match-detection/features/bib/language.js +5 -5
  22. package/src/match-detection/features/bib/media-type.js +1 -1
  23. package/src/match-detection/features/bib/melinda-id.js +1 -1
  24. package/src/match-detection/features/bib/melinda-identifier-factory.js +5 -5
  25. package/src/match-detection/features/bib/other-standard-identifier.js +1 -1
  26. package/src/match-detection/features/bib/publication-time-allow-cons-years-multi.js +6 -6
  27. package/src/match-detection/features/bib/publication-time-allow-cons-years.js +1 -1
  28. package/src/match-detection/features/bib/publication-time.js +1 -1
  29. package/src/match-detection/features/bib/standard-identifier-factory.js +1 -2
  30. package/src/match-detection/features/bib/title-version-original.js +2 -1
  31. package/src/match-detection/features/bib/title.js +6 -5
  32. package/src/match-detection/features/index.js +1 -1
  33. package/src/match-detection/index.js +1 -1
  34. package/src/match-detection/{index.spec.js → index.test.js} +9 -8
  35. package/src/matching-utils.js +8 -9
  36. package/dist/candidate-search/candidate-search-utils.js +0 -29
  37. package/dist/candidate-search/candidate-search-utils.js.map +0 -1
  38. package/dist/candidate-search/choose-queries.js +0 -122
  39. package/dist/candidate-search/choose-queries.js.map +0 -1
  40. package/dist/candidate-search/index.js +0 -260
  41. package/dist/candidate-search/index.js.map +0 -1
  42. package/dist/candidate-search/index.spec.js +0 -133
  43. package/dist/candidate-search/index.spec.js.map +0 -1
  44. package/dist/candidate-search/query-list/bib.js +0 -458
  45. package/dist/candidate-search/query-list/bib.js.map +0 -1
  46. package/dist/candidate-search/query-list/bib.spec.js +0 -46
  47. package/dist/candidate-search/query-list/bib.spec.js.map +0 -1
  48. package/dist/candidate-search/query-list/index.js +0 -47
  49. package/dist/candidate-search/query-list/index.js.map +0 -1
  50. package/dist/index.js +0 -555
  51. package/dist/index.js.map +0 -1
  52. package/dist/index.spec.js +0 -99
  53. package/dist/index.spec.js.map +0 -1
  54. package/dist/match-detection/features/bib/all-source-ids.js +0 -91
  55. package/dist/match-detection/features/bib/all-source-ids.js.map +0 -1
  56. package/dist/match-detection/features/bib/authors.js +0 -86
  57. package/dist/match-detection/features/bib/authors.js.map +0 -1
  58. package/dist/match-detection/features/bib/bibliographic-level.js +0 -15
  59. package/dist/match-detection/features/bib/bibliographic-level.js.map +0 -1
  60. package/dist/match-detection/features/bib/host-component.js +0 -15
  61. package/dist/match-detection/features/bib/host-component.js.map +0 -1
  62. package/dist/match-detection/features/bib/index.js +0 -119
  63. package/dist/match-detection/features/bib/index.js.map +0 -1
  64. package/dist/match-detection/features/bib/index.spec.js +0 -65
  65. package/dist/match-detection/features/bib/index.spec.js.map +0 -1
  66. package/dist/match-detection/features/bib/isbn.js +0 -49
  67. package/dist/match-detection/features/bib/isbn.js.map +0 -1
  68. package/dist/match-detection/features/bib/issn.js +0 -24
  69. package/dist/match-detection/features/bib/issn.js.map +0 -1
  70. package/dist/match-detection/features/bib/language.js +0 -113
  71. package/dist/match-detection/features/bib/language.js.map +0 -1
  72. package/dist/match-detection/features/bib/media-type.js +0 -56
  73. package/dist/match-detection/features/bib/media-type.js.map +0 -1
  74. package/dist/match-detection/features/bib/melinda-id.js +0 -21
  75. package/dist/match-detection/features/bib/melinda-id.js.map +0 -1
  76. package/dist/match-detection/features/bib/melinda-identifier-factory.js +0 -62
  77. package/dist/match-detection/features/bib/melinda-identifier-factory.js.map +0 -1
  78. package/dist/match-detection/features/bib/other-standard-identifier.js +0 -25
  79. package/dist/match-detection/features/bib/other-standard-identifier.js.map +0 -1
  80. package/dist/match-detection/features/bib/publication-time-allow-cons-years-multi.js +0 -229
  81. package/dist/match-detection/features/bib/publication-time-allow-cons-years-multi.js.map +0 -1
  82. package/dist/match-detection/features/bib/publication-time-allow-cons-years.js +0 -44
  83. package/dist/match-detection/features/bib/publication-time-allow-cons-years.js.map +0 -1
  84. package/dist/match-detection/features/bib/publication-time.js +0 -21
  85. package/dist/match-detection/features/bib/publication-time.js.map +0 -1
  86. package/dist/match-detection/features/bib/record-type.js +0 -18
  87. package/dist/match-detection/features/bib/record-type.js.map +0 -1
  88. package/dist/match-detection/features/bib/standard-identifier-factory.js +0 -188
  89. package/dist/match-detection/features/bib/standard-identifier-factory.js.map +0 -1
  90. package/dist/match-detection/features/bib/title-version-original.js +0 -52
  91. package/dist/match-detection/features/bib/title-version-original.js.map +0 -1
  92. package/dist/match-detection/features/bib/title.js +0 -70
  93. package/dist/match-detection/features/bib/title.js.map +0 -1
  94. package/dist/match-detection/features/index.js +0 -11
  95. package/dist/match-detection/features/index.js.map +0 -1
  96. package/dist/match-detection/index.js +0 -174
  97. package/dist/match-detection/index.js.map +0 -1
  98. package/dist/match-detection/index.spec.js +0 -63
  99. package/dist/match-detection/index.spec.js.map +0 -1
  100. package/dist/matching-utils.js +0 -115
  101. package/dist/matching-utils.js.map +0 -1
@@ -1,24 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _standardIdentifierFactory = _interopRequireDefault(require("./standard-identifier-factory"));
8
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
- var _default = () => {
10
- const {
11
- extract,
12
- compare
13
- } = (0, _standardIdentifierFactory.default)({
14
- pattern: /^022$/u,
15
- subfieldCodes: ['a', 'z', 'y']
16
- });
17
- return {
18
- extract,
19
- compare,
20
- name: 'ISSN'
21
- };
22
- };
23
- exports.default = _default;
24
- //# sourceMappingURL=issn.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"issn.js","names":["_standardIdentifierFactory","_interopRequireDefault","require","e","__esModule","default","_default","extract","compare","createInterface","pattern","subfieldCodes","name","exports"],"sources":["../../../../src/match-detection/features/bib/issn.js"],"sourcesContent":["\nimport createInterface from './standard-identifier-factory';\n\nexport default () => {\n const {extract, compare} = createInterface({pattern: /^022$/u, subfieldCodes: ['a', 'z', 'y']});\n return {extract, compare, name: 'ISSN'};\n};\n"],"mappings":";;;;;;AACA,IAAAA,0BAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA4D,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,IAAAG,QAAA,GAE7CA,CAAA,KAAM;EACnB,MAAM;IAACC,OAAO;IAAEC;EAAO,CAAC,GAAG,IAAAC,kCAAe,EAAC;IAACC,OAAO,EAAE,QAAQ;IAAEC,aAAa,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG;EAAC,CAAC,CAAC;EAC/F,OAAO;IAACJ,OAAO;IAAEC,OAAO;IAAEI,IAAI,EAAE;EAAM,CAAC;AACzC,CAAC;AAAAC,OAAA,CAAAR,OAAA,GAAAC,QAAA","ignoreList":[]}
@@ -1,113 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _debug = _interopRequireDefault(require("debug"));
8
- var _matchingUtils = require("../../../matching-utils");
9
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
- const debug = (0, _debug.default)('@natlibfi/melinda-record-matching:match-detection:features:language');
11
- const debugData = debug.extend('data');
12
- var _default = () => ({
13
- name: 'Language',
14
- extract: ({
15
- record,
16
- recordExternal
17
- }) => {
18
- const label = recordExternal && recordExternal.label ? recordExternal.label : 'record';
19
- const value008 = get008Value();
20
- const values041 = get041Values();
21
- debugData(`${label} 008: ${JSON.stringify(value008)}, 041: ${JSON.stringify(values041)}`);
22
- if (!value008 && values041.length < 1) {
23
- debugData(`{$label} No actual values found`);
24
- return [];
25
- }
26
- const allValues = value008 === undefined ? values041 : values041.concat(value008);
27
- const uniqueSortedValues = [...new Set(allValues)].sort();
28
- return uniqueSortedValues;
29
- function get008Value() {
30
- const value = record.get(/^008$/u)?.[0]?.value || undefined;
31
- debugData(`${label} 008 value: ${value}`);
32
- if (!value) {
33
- return undefined;
34
- }
35
- const code = value.slice(35, 38);
36
- debugData(`${label} 008 code: ${code}`);
37
- return isLangCodeForALanguage(code) ? code : undefined;
38
- }
39
-
40
- // Uses only f041s that have 2nd ind ' ', which means that the codes used are MARC 21 language codes
41
-
42
- function get041Values() {
43
- return record.get(/^041$/u).filter(({
44
- ind2
45
- }) => ind2 === ' ').map(({
46
- subfields
47
- }) => subfields).flat().filter(({
48
- code
49
- }) => code === 'a' || code === 'd').filter(({
50
- value
51
- }) => value && isLangCodeForALanguage(value)).map(({
52
- value
53
- }) => value);
54
- }
55
-
56
- // Check if a string is a possible, validly formed language code for a single language
57
- // Currently accept also codes in capitals
58
- function isLangCodeForALanguage(code) {
59
- if (code.length !== 3) {
60
- debugData(`Code ${code} is not correct length (3) for a language code.`);
61
- return false;
62
- }
63
- if (code === '|||' || code === ' ' || code === '^^^' || code === 'mul' || code === 'zxx') {
64
- debugData(`Code ${code} is not code for a spesific language.`);
65
- return false;
66
- }
67
- const langCodePattern = /^[a-z][a-z][a-z]$/ui;
68
- if (!langCodePattern.test(code)) {
69
- debugData(`Code ${code} is not valid as a language code`);
70
- return false;
71
- }
72
- return true;
73
- }
74
- },
75
- // eslint-disable-next-line max-statements
76
- compare: (a, b) => {
77
- debugData(`Comparing ${JSON.stringify(a)} and ${JSON.stringify(b)}`);
78
- if (a.length === 0 || b.length === 0) {
79
- debugData(`No language to compare`);
80
- return 0;
81
- }
82
- if (a.length === b.length && a.every((element, index) => element === b[index])) {
83
- debugData(`All languages match`);
84
- return 0.1;
85
- }
86
- const {
87
- matchingValues,
88
- possibleMatchValues,
89
- maxValues
90
- } = (0, _matchingUtils.getMatchCounts)(a, b);
91
- if (matchingValues < 1) {
92
- debug(`Both have languages, but none of these match.`);
93
- return -1.0;
94
- }
95
- debug(`Both have languages, ${matchingValues}/${possibleMatchValues} valid languages match.`);
96
- // ignore non-matches if there is mismatching amount of values
97
- debug(`Possible matches: ${possibleMatchValues}/${maxValues}`);
98
- //we give some kind of penalty for mismatching amount of values instead of simple divide?
99
- const missingCount = maxValues - possibleMatchValues;
100
- const misMatchCount = possibleMatchValues - matchingValues;
101
- debug(`\t missing: ${missingCount}`);
102
- debug(`\t mismatches: ${misMatchCount}`);
103
- const penaltyForMissing = 0.02 * (maxValues - possibleMatchValues);
104
- const penaltyForMisMatch = 0.05 * (possibleMatchValues - matchingValues);
105
- debug(`\t points: penaltyForMissing: ${penaltyForMissing}`);
106
- debug(`\t points: penaltyForMisMatch: ${penaltyForMisMatch}`);
107
- const points = Number(Number(0.1 - penaltyForMisMatch - penaltyForMissing).toFixed(2));
108
- debug(`Total points: ${points}`);
109
- return points;
110
- }
111
- });
112
- exports.default = _default;
113
- //# sourceMappingURL=language.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"language.js","names":["_debug","_interopRequireDefault","require","_matchingUtils","e","__esModule","default","debug","createDebugLogger","debugData","extend","_default","name","extract","record","recordExternal","label","value008","get008Value","values041","get041Values","JSON","stringify","length","allValues","undefined","concat","uniqueSortedValues","Set","sort","value","get","code","slice","isLangCodeForALanguage","filter","ind2","map","subfields","flat","langCodePattern","test","compare","a","b","every","element","index","matchingValues","possibleMatchValues","maxValues","getMatchCounts","missingCount","misMatchCount","penaltyForMissing","penaltyForMisMatch","points","Number","toFixed","exports"],"sources":["../../../../src/match-detection/features/bib/language.js"],"sourcesContent":["\nimport createDebugLogger from 'debug';\nimport {getMatchCounts} from '../../../matching-utils';\n\nconst debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features:language');\nconst debugData = debug.extend('data');\n\nexport default () => ({\n name: 'Language',\n extract: ({record, recordExternal}) => {\n const label = recordExternal && recordExternal.label ? recordExternal.label : 'record';\n\n const value008 = get008Value();\n const values041 = get041Values();\n debugData(`${label} 008: ${JSON.stringify(value008)}, 041: ${JSON.stringify(values041)}`);\n\n if (!value008 && values041.length < 1) {\n debugData(`{$label} No actual values found`);\n return [];\n }\n\n const allValues = value008 === undefined ? values041 : values041.concat(value008);\n const uniqueSortedValues = [...new Set(allValues)].sort();\n\n return uniqueSortedValues;\n\n function get008Value() {\n const value = record.get(/^008$/u)?.[0]?.value || undefined;\n debugData(`${label} 008 value: ${value}`);\n\n if (!value) {\n return undefined;\n }\n\n const code = value.slice(35, 38);\n debugData(`${label} 008 code: ${code}`);\n return isLangCodeForALanguage(code) ? code : undefined;\n }\n\n // Uses only f041s that have 2nd ind ' ', which means that the codes used are MARC 21 language codes\n\n function get041Values() {\n return record.get(/^041$/u)\n .filter(({ind2}) => ind2 === ' ')\n .map(({subfields}) => subfields)\n .flat()\n .filter(({code}) => code === 'a' || code === 'd')\n .filter(({value}) => value && isLangCodeForALanguage(value))\n .map(({value}) => value);\n }\n\n // Check if a string is a possible, validly formed language code for a single language\n // Currently accept also codes in capitals\n function isLangCodeForALanguage(code) {\n if (code.length !== 3) {\n debugData(`Code ${code} is not correct length (3) for a language code.`);\n return false;\n }\n if (code === '|||' || code === ' ' || code === '^^^' || code === 'mul' || code === 'zxx') {\n debugData(`Code ${code} is not code for a spesific language.`);\n return false;\n }\n const langCodePattern = /^[a-z][a-z][a-z]$/ui;\n if (!langCodePattern.test(code)) {\n debugData(`Code ${code} is not valid as a language code`);\n return false;\n }\n return true;\n }\n\n },\n // eslint-disable-next-line max-statements\n compare: (a, b) => {\n debugData(`Comparing ${JSON.stringify(a)} and ${JSON.stringify(b)}`);\n\n if (a.length === 0 || b.length === 0) {\n debugData(`No language to compare`);\n return 0;\n }\n\n if (a.length === b.length && a.every((element, index) => element === b[index])) {\n debugData(`All languages match`);\n return 0.1;\n }\n\n const {matchingValues, possibleMatchValues, maxValues} = getMatchCounts(a, b);\n\n if (matchingValues < 1) {\n debug(`Both have languages, but none of these match.`);\n return -1.0;\n }\n debug(`Both have languages, ${matchingValues}/${possibleMatchValues} valid languages match.`);\n // ignore non-matches if there is mismatching amount of values\n debug(`Possible matches: ${possibleMatchValues}/${maxValues}`);\n //we give some kind of penalty for mismatching amount of values instead of simple divide?\n const missingCount = maxValues - possibleMatchValues;\n const misMatchCount = possibleMatchValues - matchingValues;\n debug(`\\t missing: ${missingCount}`);\n debug(`\\t mismatches: ${misMatchCount}`);\n\n const penaltyForMissing = 0.02 * (maxValues - possibleMatchValues);\n const penaltyForMisMatch = 0.05 * (possibleMatchValues - matchingValues);\n debug(`\\t points: penaltyForMissing: ${penaltyForMissing}`);\n debug(`\\t points: penaltyForMisMatch: ${penaltyForMisMatch}`);\n\n const points = Number(Number(0.1 - penaltyForMisMatch - penaltyForMissing).toFixed(2));\n debug(`Total points: ${points}`);\n\n return points;\n }\n});\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAAuD,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEvD,MAAMG,KAAK,GAAG,IAAAC,cAAiB,EAAC,q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;IACxEzC,KAAK,CAAC,iCAAiC+C,iBAAiB,EAAE,CAAC;IAC3D/C,KAAK,CAAC,kCAAkCgD,kBAAkB,EAAE,CAAC;IAE7D,MAAMC,MAAM,GAAGC,MAAM,CAACA,MAAM,CAAC,GAAG,GAAGF,kBAAkB,GAAGD,iBAAiB,CAAC,CAACI,OAAO,CAAC,CAAC,CAAC,CAAC;IACtFnD,KAAK,CAAC,iBAAiBiD,MAAM,EAAE,CAAC;IAEhC,OAAOA,MAAM;EACf;AACF,CAAC,CAAC;AAAAG,OAAA,CAAArD,OAAA,GAAAK,QAAA","ignoreList":[]}
@@ -1,56 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _debug = _interopRequireDefault(require("debug"));
8
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
- /* eslint-disable max-statements */
10
-
11
- const debug = (0, _debug.default)('@natlibfi/melinda-record-matching:match-detection:features:media-type');
12
- const debugData = debug.extend('data');
13
- var _default = () => ({
14
- name: 'Media type',
15
- extract: ({
16
- record,
17
- recordExternal
18
- }) => {
19
- const label = recordExternal && recordExternal.label ? recordExternal.label : 'record';
20
- debugData(`Record (${label}): ${JSON.stringify(record)}`);
21
- debugData(`RecordExternal: ${JSON.stringify(recordExternal)}`);
22
- const values337 = get337Values();
23
- debug(`${label} 337 $b values: ${JSON.stringify(values337)}`);
24
- return values337;
25
- function get337Values() {
26
- return record.get(/^337$/u).filter(f => f.subfields.some(subfield => subfield.code === '2' && subfield.value === 'rdamedia')).map(({
27
- subfields
28
- }) => subfields).flat().filter(({
29
- code
30
- }) => code === 'b').map(({
31
- value
32
- }) => value);
33
- }
34
- },
35
- compare: (a, b) => {
36
- debugData(`Comparing ${JSON.stringify(a)} and ${JSON.stringify(b)}`);
37
-
38
- // Should we give extra good points if all mediaTypes match?
39
- // Should we give partial points for partially matching mediaTypes?
40
- // Should we check whether recordType is 'mixedMaterials'
41
- // Should we okay typical cases of not totally matching mediaTypes? What would these be?
42
-
43
- if (a.every(elem => b.includes(elem))) {
44
- debug(`All mediaTypes from A are in B`);
45
- return 1;
46
- }
47
- if (b.every(elem => a.includes(elem))) {
48
- debug(`All mediaTypes from B are in A`);
49
- return 1;
50
- }
51
- debug(`Mismatch in mediaTypes between A and B`);
52
- return -1;
53
- }
54
- });
55
- exports.default = _default;
56
- //# sourceMappingURL=media-type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"media-type.js","names":["_debug","_interopRequireDefault","require","e","__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,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;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;EAClBC,OAAO,EAAEA,CAAC;IAACC,MAAM;IAAEC;EAAc,CAAC,KAAK;IACrC,MAAMC,KAAK,GAAGD,cAAc,IAAIA,cAAc,CAACC,KAAK,GAAGD,cAAc,CAACC,KAAK,GAAG,QAAQ;IACtFP,SAAS,CAAC,WAAWO,KAAK,MAAMC,IAAI,CAACC,SAAS,CAACJ,MAAM,CAAC,EAAE,CAAC;IACzDL,SAAS,CAAC,mBAAmBQ,IAAI,CAACC,SAAS,CAACH,cAAc,CAAC,EAAE,CAAC;IAC9D,MAAMI,SAAS,GAAGC,YAAY,CAAC,CAAC;IAChCb,KAAK,CAAC,GAAGS,KAAK,mBAAmBC,IAAI,CAACC,SAAS,CAACC,SAAS,CAAC,EAAE,CAAC;IAE7D,OAAOA,SAAS;IAEhB,SAASC,YAAYA,CAAA,EAAG;MACtB,OAAON,MAAM,CAACO,GAAG,CAAC,QAAQ,CAAC,CACxBC,MAAM,CAACC,CAAC,IAAIA,CAAC,CAACC,SAAS,CAACC,IAAI,CAAEC,QAAQ,IAAKA,QAAQ,CAACC,IAAI,KAAK,GAAG,IAAID,QAAQ,CAACE,KAAK,KAAK,UAAU,CAAC,CAAC,CACnGC,GAAG,CAAC,CAAC;QAACL;MAAS,CAAC,KAAKA,SAAS,CAAC,CAC/BM,IAAI,CAAC,CAAC,CACNR,MAAM,CAAC,CAAC;QAACK;MAAI,CAAC,KAAKA,IAAI,KAAK,GAAG,CAAC,CAChCE,GAAG,CAAC,CAAC;QAACD;MAAK,CAAC,KAAKA,KAAK,CAAC;IAC5B;EACF,CAAC;EACDG,OAAO,EAAEA,CAACC,CAAC,EAAEC,CAAC,KAAK;IACjBxB,SAAS,CAAC,aAAaQ,IAAI,CAACC,SAAS,CAACc,CAAC,CAAC,QAAQf,IAAI,CAACC,SAAS,CAACe,CAAC,CAAC,EAAE,CAAC;;IAEpE;IACA;IACA;IACA;;IAEA,IAAID,CAAC,CAACE,KAAK,CAACC,IAAI,IAAIF,CAAC,CAACG,QAAQ,CAACD,IAAI,CAAC,CAAC,EAAE;MACrC5B,KAAK,CAAC,gCAAgC,CAAC;MACvC,OAAO,CAAC;IACV;IAEA,IAAI0B,CAAC,CAACC,KAAK,CAACC,IAAI,IAAIH,CAAC,CAACI,QAAQ,CAACD,IAAI,CAAC,CAAC,EAAE;MACrC5B,KAAK,CAAC,gCAAgC,CAAC;MACvC,OAAO,CAAC;IACV;IAEAA,KAAK,CAAC,wCAAwC,CAAC;IAC/C,OAAO,CAAC,CAAC;EAEX;AACF,CAAC,CAAC;AAAA8B,OAAA,CAAA/B,OAAA,GAAAK,QAAA","ignoreList":[]}
@@ -1,21 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _melindaIdentifierFactory = _interopRequireDefault(require("./melinda-identifier-factory"));
8
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
- var _default = () => {
10
- const {
11
- extract,
12
- compare
13
- } = (0, _melindaIdentifierFactory.default)();
14
- return {
15
- extract,
16
- compare,
17
- name: 'melinda-id'
18
- };
19
- };
20
- exports.default = _default;
21
- //# sourceMappingURL=melinda-id.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"melinda-id.js","names":["_melindaIdentifierFactory","_interopRequireDefault","require","e","__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,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;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":[]}
@@ -1,62 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _debug = _interopRequireDefault(require("debug"));
8
- var _matchingUtils = require("../../../matching-utils");
9
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
- // 003+001 FI-MELINDA <melinda-id>
11
- // 035 $a (FI-MELINDA)<melinda-id>
12
- // 035 $z (FI-MELINDA)<melinda-id>
13
- // 035 $a FCC<melinda-id>
14
- // 035 $z FCC<melinda-id>
15
- // melinda-id = 001234567
16
- var _default = () => {
17
- const debug = (0, _debug.default)('@natlibfi/melinda-record-matching:match-detection:features/bib/melinda-id');
18
- const debugData = debug.extend('data');
19
- return {
20
- extract,
21
- compare
22
- };
23
- function extract({
24
- record,
25
- recordExternal
26
- }) {
27
- const isMelindaRecord = record.get('003').some(f003 => f003.value === 'FI-MELINDA');
28
- const [f001] = record.get('001').map(field => field.value);
29
- const f035MelindaIds = (0, _matchingUtils.getMelindaIdsF035)(record);
30
- if (isMelindaRecord === undefined && f001 === undefined && f035MelindaIds.length < 1) {
31
- debug(`${recordExternal.label} No Melinda-IDs found`);
32
- return {};
33
- }
34
- return {
35
- isMelindaRecord,
36
- f001,
37
- f035MelindaIds
38
- };
39
- }
40
- function compare(a, b) {
41
- if (a.isMelindaRecord && b.isMelindaRecord && a.f001 === b.f001) {
42
- debugData(`Melinda record's A f001 ${a.f001} matches Melinda record's B f001 ${a.f001}`);
43
- return 1;
44
- }
45
- if (a.isMelindaRecord && typeof b.f035MelindaIds !== 'undefined' && b.f035MelindaIds.some(id => id === a.f001)) {
46
- debugData(`Melinda record's A f001 ${a.f001} matches record B f035 ${JSON.stringify(b.f035MelindaIds)}`);
47
- return 1;
48
- }
49
- if (b.isMelindaRecord && typeof a.f035MelindaIds !== 'undefined' && a.f035MelindaIds.some(id => id === b.f001)) {
50
- debugData(`Melinda record's B f001 ${b.f001} matches record A f035 ${JSON.stringify(a.f035MelindaIds)}`);
51
- return 1;
52
- }
53
- if (typeof a.f035MelindaIds !== 'undefined' && typeof b.f035MelindaIds !== 'undefined' && a.f035MelindaIds.some(idA => b.f035MelindaIds.some(idB => idB === idA))) {
54
- debugData(`Record A f035 ${JSON.stringify(a.f035MelindaIds)} matches record B f035 ${JSON.stringify(b.f035MelindaIds)}`);
55
- return 1;
56
- }
57
- debug(`No matching Melinda-IDs.`);
58
- return 0;
59
- }
60
- };
61
- exports.default = _default;
62
- //# sourceMappingURL=melinda-identifier-factory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"melinda-identifier-factory.js","names":["_debug","_interopRequireDefault","require","_matchingUtils","e","__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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ACxH,OAAO,CAAC;IACV;IACAhB,KAAK,CAAC,0BAA0B,CAAC;IACjC,OAAO,CAAC;EACV;AACF,CAAC;AAAA4B,OAAA,CAAA9B,OAAA,GAAAC,QAAA","ignoreList":[]}
@@ -1,25 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _standardIdentifierFactory = _interopRequireDefault(require("./standard-identifier-factory"));
8
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
- // DEVELOP: we should compare indicators and sf2 for f024
10
- var _default = () => {
11
- const {
12
- extract,
13
- compare
14
- } = (0, _standardIdentifierFactory.default)({
15
- pattern: /^024$/u,
16
- subfieldCodes: ['a', 'z']
17
- });
18
- return {
19
- extract,
20
- compare,
21
- name: 'Other standard identifier'
22
- };
23
- };
24
- exports.default = _default;
25
- //# sourceMappingURL=other-standard-identifier.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"other-standard-identifier.js","names":["_standardIdentifierFactory","_interopRequireDefault","require","e","__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,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;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":[]}
@@ -1,229 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _matchingUtils = require("../../../matching-utils");
8
- var _debug = _interopRequireDefault(require("debug"));
9
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
- // We should also get copyright time and copyright/publication times from 26x
11
- // We should also get publishing time type from f008
12
- // We should get reprint times from f500 $a "Lisäpainos/Lisäpainokset:"
13
- var _default = () => ({
14
- name: 'Publication time, allow consequent years, years from multiple sources',
15
- extract: ({
16
- record,
17
- recordExternal
18
- }) => {
19
- const debug = (0, _debug.default)('@natlibfi/melinda-record-matching:match-detection:features/bib/publication-time-allow-cons-years-multi');
20
- const label = recordExternal && recordExternal.label ? recordExternal.label : 'record';
21
- const f008Values = extractF008Values(record);
22
- debug(`${label} f008: ${JSON.stringify(f008Values)}`);
23
- const f26xValues = extractF26xValues(record);
24
- debug(`${label} f26x: ${JSON.stringify(f26xValues)}`);
25
- const f500Values = extractF500Years(record);
26
- debug(`${label} f500: ${JSON.stringify(f500Values)}`);
27
-
28
- // We should get copyrightYear from f008Date2 to copyrightYears when f008YearType = 'r'
29
- // Is the original year (f008Date2) in f008YearType === 'r' comparable to copyrightYear?
30
- // We should handle unknown years (here or comparison?)
31
- // We should handle year ranges for continuing resources / collections
32
-
33
- const normalYears = [...new Set(f26xValues.normalYears.concat(f008Values.f008Date1).filter(value => value && value !== ' ' && value !== '||||'))].sort();
34
- const copyrightYears = [...new Set(f26xValues.copyrightYears)].sort();
35
- const reprintYears = [...new Set(f500Values)].sort();
36
- const combined = {
37
- normalYears,
38
- copyrightYears,
39
- reprintYears
40
- };
41
- debug(`Combined: ${JSON.stringify(combined)}`);
42
- return combined;
43
- function extractF008Values(record) {
44
- // Record should have only one f008 - in case of several, we handle the first one
45
- const value = record.get(/^008$/u)?.[0]?.value || undefined;
46
- if (value && (0, _matchingUtils.testStringOrNumber)(value)) {
47
- const f008Date1 = extractF008Date1(value);
48
- const f008Date2 = extractF008Date2(value);
49
- const f008YearType = extractF008YearType(value);
50
- return {
51
- f008Date1,
52
- f008Date2,
53
- f008YearType
54
- };
55
- }
56
- return {
57
- f008Date1: undefined,
58
- f008Date2: undefined,
59
- f008YearType: undefined
60
- };
61
- function extractF008Date1(value) {
62
- return String(value).slice(7, 11);
63
- }
64
- function extractF008Date2(value) {
65
- return String(value).slice(11, 15);
66
- }
67
- function extractF008YearType(value) {
68
- return String(value).slice(6, 7);
69
- }
70
- }
71
- function extractF26xValues(record) {
72
- const copyrightRegex = /^(?<copyrightPrefix>cop|cop.|c|©|p|℗)/u;
73
- const pubNormalSubFieldValues = extractPubNormalSubfieldValues(record, copyrightRegex);
74
- debug(`Normal years: ${JSON.stringify(pubNormalSubFieldValues)}`);
75
- const pubF264CopySubFieldValues = extractPubF264CopySubfieldValues(record);
76
- debug(`F264 copyright years: ${JSON.stringify(pubF264CopySubFieldValues)}`);
77
- const pubF260CopySubFieldValues = extractPubF260CopySubfieldValues(record, copyrightRegex);
78
- debug(`F260 copyright years: ${JSON.stringify(pubF260CopySubFieldValues)}`);
79
- return {
80
- normalYears: pubNormalSubFieldValues,
81
- copyrightYears: [...pubF260CopySubFieldValues, ...pubF264CopySubFieldValues]
82
- };
83
- function extractPubNormalSubfieldValues(record, copyrightRegex) {
84
- return record.get(/^26[04]$/u).filter(field => !(field.tag === '264' && field.ind2 === '4')).map(({
85
- subfields
86
- }) => subfields).flat().filter(({
87
- code
88
- }) => code && code === 'c').filter(({
89
- value
90
- }) => value && !copyrightRegex.test(value)).map(({
91
- value
92
- }) => value).map(value => removeNonAlphaNumeric(value));
93
- }
94
- function extractPubF264CopySubfieldValues(record, copyrightRegex) {
95
- return record.get(/^264$/u).filter(field => field.ind2 === '4').map(({
96
- subfields
97
- }) => subfields).flat().filter(({
98
- code
99
- }) => code && code === 'c').filter(({
100
- value
101
- }) => value).map(({
102
- value
103
- }) => value).map(value => value.replace(copyrightRegex, '')).map(value => removeNonAlphaNumeric(value));
104
- }
105
- function extractPubF260CopySubfieldValues(record, copyrightRegex) {
106
- return record.get(/^260$/u).map(({
107
- subfields
108
- }) => subfields).flat().filter(({
109
- code
110
- }) => code && code === 'c').filter(({
111
- value
112
- }) => value && copyrightRegex.test(value)).map(({
113
- value
114
- }) => value).map(value => value.replace(copyrightRegex, '')).map(value => removeNonAlphaNumeric(value));
115
- }
116
- function removeNonAlphaNumeric(value) {
117
- debug(`Cleaning: ${JSON.stringify(value)}`);
118
- const nonAlphaNumericRegex = /[^A-Za-z0-9]/ug;
119
- return value ? value.replace(nonAlphaNumericRegex, '') : value;
120
- }
121
- }
122
- function extractF500Years(record) {
123
- const reprintRegex = /(?<reprint>Lisäpainokset:|Lisäpainos:)/u;
124
- const reprintFieldContents = record.get(/^500$/u).map(({
125
- subfields
126
- }) => subfields).flat().filter(({
127
- code
128
- }) => code === 'a').map(({
129
- value
130
- }) => value);
131
- //.filter(value => value.test(reprintRegex));
132
-
133
- debug(`f500 reprint field contents: ${JSON.stringify(reprintFieldContents)}`);
134
- const filteredF500 = reprintFieldContents.filter(content => content && content.match(reprintRegex));
135
- debug(`f500 reprint field contents (filtered): ${JSON.stringify(filteredF500)}`);
136
- const reprintYears = extractReprintYears(filteredF500);
137
- return reprintYears;
138
- }
139
- function extractReprintYears(contents) {
140
- const yearRegex = /[0-9][0-9][0-9][0-9]/gu;
141
- const years = contents.map(content => content.match(yearRegex)).flat();
142
- debug(`${JSON.stringify(years)}`);
143
- const uniqYears = [...new Set(years)].sort();
144
- debug(`${JSON.stringify(uniqYears)}`);
145
- return uniqYears;
146
- }
147
- },
148
- // eslint-disable-next-line max-statements
149
- compare: (a, b) => {
150
- const debug = (0, _debug.default)('@natlibfi/melinda-record-matching:match-detection:features/bib/publication-time-allow-cons-years-multi');
151
- debug(`Comparing ${JSON.stringify(a)} to ${JSON.stringify(b)}`);
152
- const [firstA] = a.normalYears ? a.normalYears : a;
153
- const [firstB] = b.normalYears ? b.normalYears : b;
154
- debug(`Comparing ${JSON.stringify(firstA)} to ${JSON.stringify(firstB)}`);
155
- if (firstA === firstB) {
156
- return 0.1;
157
- }
158
-
159
- // If either of years is a non string/number, values are not comparable
160
- if (!(0, _matchingUtils.testStringOrNumber)(firstA) || !(0, _matchingUtils.testStringOrNumber)(firstB)) {
161
- return 0;
162
- }
163
- const firstANumber = parseInt(firstA, 10);
164
- const firstBNumber = parseInt(firstB, 10);
165
-
166
- // Handle consequent years as a match
167
- // see publication-time for a version that does not handle consequent years as a match
168
- if (!(isNaN(firstANumber) || isNaN(firstBNumber)) && (firstANumber + 1 === firstBNumber || firstANumber - 1 === firstBNumber)) {
169
- return 0.1;
170
- }
171
-
172
- // We should do something with copyrightYears, too
173
-
174
- // Do not give minus points if a normal publishing year is found in normal years
175
- const bNormalInANormal = a.normalYears.filter(aValue => b.normalYears.some(bValue => aValue === bValue));
176
- const aNormalInBNormal = b.normalYears.filter(bValue => a.normalYears.some(aValue => bValue === aValue));
177
- debug(`BNorm in ANorm: ${JSON.stringify(bNormalInANormal)}`);
178
- debug(`ANorm in BNorm: ${JSON.stringify(aNormalInBNormal)}`);
179
- if (bNormalInANormal > 0 || aNormalInBNormal > 0) {
180
- return 0;
181
- }
182
-
183
- // Do not give minus points if a normal publishing year is found in reprint years
184
- const bNormalInAReprint = a.reprintYears.filter(aValue => b.normalYears.some(bValue => aValue === bValue));
185
- const aNormalInBReprint = b.reprintYears.filter(bValue => a.normalYears.some(aValue => bValue === aValue));
186
- debug(`BNorm in AReprint: ${JSON.stringify(bNormalInAReprint)}`);
187
- debug(`ANorm in BReprint: ${JSON.stringify(aNormalInBReprint)}`);
188
- if (bNormalInAReprint > 0 || aNormalInBReprint > 0) {
189
- return 0;
190
- }
191
- return -1;
192
- }
193
- }); // https://www.loc.gov/marc/bibliographic/bd008.html
194
- // field 008
195
- // 06 - Type of date/Publication status
196
- // 07-10 - Date 1
197
- // 11-14 - Date 2
198
- //
199
- // 06 - Type of date/Publication status
200
- // b - No dates given; B.C. date involved
201
- // c - Continuing resource currently published
202
- // d - Continuing resource ceased publication
203
- // e - Detailed date
204
- // i - Inclusive dates of collection
205
- // k - Range of years of bulk of collection
206
- // m - Multiple dates
207
- // n - Dates unknown
208
- // p - Date of distribution/release/issue and production/recording session when different
209
- // q - Questionable date
210
- // r - Reprint/reissue date and original date
211
- // s - Single known date/probable date
212
- // t - Publication date and copyright date
213
- // u - Continuing resource status unknown
214
- // | - No attempt to code
215
- //
216
- // 07-10 - Date 1
217
- // 1-9 - Date digit
218
- // # - Date element is not applicable
219
- // u - Date element is totally or partially unknown
220
- // |||| - No attempt to code
221
- //
222
- // 11-14 - Date 2
223
- // 1-9 - Date digit
224
- // # - Date element is not applicable
225
- // u - Date element is totally or partially unknown
226
- // |||| - No attempt to code
227
- //
228
- exports.default = _default;
229
- //# sourceMappingURL=publication-time-allow-cons-years-multi.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"publication-time-allow-cons-years-multi.js","names":["_matchingUtils","require","_debug","_interopRequireDefault","e","__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,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEtC;AACA;AACA;AAAA,IAAAG,QAAA,GAEeA,CAAA,MAAO;EACpBC,IAAI,EAAE,uEAAuE;EAC7EC,OAAO,EAAEA,CAAC;IAACC,MAAM;IAAEC;EAAc,CAAC,KAAK;IACrC,MAAMC,KAAK,GAAG,IAAAC,cAAiB,EAAC,wGAAwG,CAAC;IACzI,MAAMC,KAAK,GAAGH,cAAc,IAAIA,cAAc,CAACG,KAAK,GAAGH,cAAc,CAACG,KAAK,GAAG,QAAQ;IAEtF,MAAMC,UAAU,GAAGC,iBAAiB,CAACN,MAAM,CAAC;IAC5CE,KAAK,CAAC,GAAGE,KAAK,UAAUG,IAAI,CAACC,SAAS,CAACH,UAAU,CAAC,EAAE,CAAC;IAErD,MAAMI,UAAU,GAAGC,iBAAiB,CAACV,MAAM,CAAC;IAC5CE,KAAK,CAAC,GAAGE,KAAK,UAAUG,IAAI,CAACC,SAAS,CAACC,UAAU,CAAC,EAAE,CAAC;IAErD,MAAME,UAAU,GAAGC,gBAAgB,CAACZ,MAAM,CAAC;IAC3CE,KAAK,CAAC,GAAGE,KAAK,UAAUG,IAAI,CAACC,SAAS,CAACG,UAAU,CAAC,EAAE,CAAC;;IAErD;IACA;IACA;IACA;;IAEA,MAAME,WAAW,GAAG,CAAC,GAAG,IAAIC,GAAG,CAACL,UAAU,CAACI,WAAW,CAACE,MAAM,CAACV,UAAU,CAACW,SAAS,CAAC,CAACC,MAAM,CAACC,KAAK,IAAIA,KAAK,IAAIA,KAAK,KAAK,MAAM,IAAIA,KAAK,KAAK,MAAM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