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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/.github/workflows/melinda-node-tests.yml +13 -9
  2. package/LICENSE.txt +21 -165
  3. package/README.md +2 -2
  4. package/dist/candidate-search/candidate-search-utils.js +6 -43
  5. package/dist/candidate-search/candidate-search-utils.js.map +7 -1
  6. package/dist/candidate-search/choose-queries.js +75 -0
  7. package/dist/candidate-search/choose-queries.js.map +7 -0
  8. package/dist/candidate-search/index.js +89 -225
  9. package/dist/candidate-search/index.js.map +7 -1
  10. package/dist/candidate-search/index.test.js +92 -0
  11. package/dist/candidate-search/index.test.js.map +7 -0
  12. package/dist/candidate-search/query-list/bib.js +141 -320
  13. package/dist/candidate-search/query-list/bib.js.map +7 -1
  14. package/dist/candidate-search/query-list/bib.test.js +34 -0
  15. package/dist/candidate-search/query-list/bib.test.js.map +7 -0
  16. package/dist/candidate-search/query-list/component.js +87 -0
  17. package/dist/candidate-search/query-list/component.js.map +7 -0
  18. package/dist/candidate-search/query-list/index.js +39 -52
  19. package/dist/candidate-search/query-list/index.js.map +7 -1
  20. package/dist/cli.js +138 -0
  21. package/dist/cli.js.map +7 -0
  22. package/dist/index.js +87 -462
  23. package/dist/index.js.map +7 -1
  24. package/dist/index.test.js +69 -0
  25. package/dist/index.test.js.map +7 -0
  26. package/dist/match-detection/features/bib/all-source-ids.js +20 -91
  27. package/dist/match-detection/features/bib/all-source-ids.js.map +7 -1
  28. package/dist/match-detection/features/bib/authors.js +20 -76
  29. package/dist/match-detection/features/bib/authors.js.map +7 -1
  30. package/dist/match-detection/features/bib/bibliographic-level.js +4 -40
  31. package/dist/match-detection/features/bib/bibliographic-level.js.map +7 -1
  32. package/dist/match-detection/features/bib/host-component.js +5 -41
  33. package/dist/match-detection/features/bib/host-component.js.map +7 -1
  34. package/dist/match-detection/features/bib/index.js +17 -119
  35. package/dist/match-detection/features/bib/index.js.map +7 -1
  36. package/dist/match-detection/features/bib/index.test.js +40 -0
  37. package/dist/match-detection/features/bib/index.test.js.map +7 -0
  38. package/dist/match-detection/features/bib/isbn.js +13 -69
  39. package/dist/match-detection/features/bib/isbn.js.map +7 -1
  40. package/dist/match-detection/features/bib/issn.js +5 -50
  41. package/dist/match-detection/features/bib/issn.js.map +7 -1
  42. package/dist/match-detection/features/bib/language.js +25 -86
  43. package/dist/match-detection/features/bib/language.js.map +7 -1
  44. package/dist/match-detection/features/bib/media-type.js +12 -64
  45. package/dist/match-detection/features/bib/media-type.js.map +7 -1
  46. package/dist/match-detection/features/bib/melinda-id.js +5 -47
  47. package/dist/match-detection/features/bib/melinda-id.js.map +7 -1
  48. package/dist/match-detection/features/bib/melinda-identifier-factory.js +16 -67
  49. package/dist/match-detection/features/bib/melinda-identifier-factory.js.map +7 -1
  50. package/dist/match-detection/features/bib/other-standard-identifier.js +5 -51
  51. package/dist/match-detection/features/bib/other-standard-identifier.js.map +7 -1
  52. package/dist/match-detection/features/bib/publication-time-allow-cons-years-multi.js +49 -189
  53. package/dist/match-detection/features/bib/publication-time-allow-cons-years-multi.js.map +7 -1
  54. package/dist/match-detection/features/bib/publication-time-allow-cons-years.js +10 -53
  55. package/dist/match-detection/features/bib/publication-time-allow-cons-years.js.map +7 -1
  56. package/dist/match-detection/features/bib/publication-time.js +8 -46
  57. package/dist/match-detection/features/bib/publication-time.js.map +7 -1
  58. package/dist/match-detection/features/bib/record-type.js +4 -43
  59. package/dist/match-detection/features/bib/record-type.js.map +7 -1
  60. package/dist/match-detection/features/bib/standard-identifier-factory.js +47 -163
  61. package/dist/match-detection/features/bib/standard-identifier-factory.js.map +7 -1
  62. package/dist/match-detection/features/bib/title-version-original.js +11 -53
  63. package/dist/match-detection/features/bib/title-version-original.js.map +7 -1
  64. package/dist/match-detection/features/bib/title.js +20 -72
  65. package/dist/match-detection/features/bib/title.js.map +7 -1
  66. package/dist/match-detection/features/index.js +3 -11
  67. package/dist/match-detection/features/index.js.map +7 -1
  68. package/dist/match-detection/index.js +35 -150
  69. package/dist/match-detection/index.js.map +7 -1
  70. package/dist/match-detection/index.test.js +44 -0
  71. package/dist/match-detection/index.test.js.map +7 -0
  72. package/dist/matching-utils.js +38 -102
  73. package/dist/matching-utils.js.map +7 -1
  74. package/eslint.config.js +52 -0
  75. package/example.env +4 -0
  76. package/package.json +29 -78
  77. package/src/candidate-search/candidate-search-utils.js +1 -28
  78. package/src/candidate-search/choose-queries.js +93 -0
  79. package/src/candidate-search/index.js +85 -119
  80. package/src/candidate-search/{index.spec.js → index.test.js} +30 -43
  81. package/src/candidate-search/query-list/bib.js +54 -55
  82. package/src/candidate-search/query-list/bib.test.js +38 -0
  83. package/src/candidate-search/query-list/component.js +127 -0
  84. package/src/candidate-search/query-list/index.js +31 -35
  85. package/src/cli.js +177 -0
  86. package/src/index.js +27 -68
  87. package/src/{index.spec.js → index.test.js} +11 -42
  88. package/src/match-detection/features/bib/all-source-ids.js +2 -29
  89. package/src/match-detection/features/bib/authors.js +5 -30
  90. package/src/match-detection/features/bib/bibliographic-level.js +0 -27
  91. package/src/match-detection/features/bib/host-component.js +0 -27
  92. package/src/match-detection/features/bib/index.js +16 -43
  93. package/src/match-detection/features/bib/index.test.js +52 -0
  94. package/src/match-detection/features/bib/isbn.js +2 -29
  95. package/src/match-detection/features/bib/issn.js +1 -28
  96. package/src/match-detection/features/bib/language.js +5 -32
  97. package/src/match-detection/features/bib/media-type.js +2 -28
  98. package/src/match-detection/features/bib/melinda-id.js +1 -28
  99. package/src/match-detection/features/bib/melinda-identifier-factory.js +5 -32
  100. package/src/match-detection/features/bib/other-standard-identifier.js +1 -28
  101. package/src/match-detection/features/bib/publication-time-allow-cons-years-multi.js +7 -34
  102. package/src/match-detection/features/bib/publication-time-allow-cons-years.js +1 -28
  103. package/src/match-detection/features/bib/publication-time.js +2 -28
  104. package/src/match-detection/features/bib/record-type.js +0 -27
  105. package/src/match-detection/features/bib/standard-identifier-factory.js +1 -28
  106. package/src/match-detection/features/bib/title-version-original.js +2 -28
  107. package/src/match-detection/features/bib/title.js +6 -34
  108. package/src/match-detection/features/index.js +1 -28
  109. package/src/match-detection/index.js +1 -28
  110. package/src/match-detection/{index.spec.js → index.test.js} +9 -35
  111. package/src/matching-utils.js +8 -37
  112. package/dist/candidate-search/index.spec.js +0 -144
  113. package/dist/candidate-search/index.spec.js.map +0 -1
  114. package/dist/candidate-search/query-list/bib.spec.js +0 -64
  115. package/dist/candidate-search/query-list/bib.spec.js.map +0 -1
  116. package/dist/index.spec.js +0 -127
  117. package/dist/index.spec.js.map +0 -1
  118. package/dist/match-detection/features/bib/index.spec.js +0 -93
  119. package/dist/match-detection/features/bib/index.spec.js.map +0 -1
  120. package/dist/match-detection/index.spec.js +0 -91
  121. package/dist/match-detection/index.spec.js.map +0 -1
  122. package/src/candidate-search/query-list/bib.spec.js +0 -54
  123. package/src/match-detection/features/bib/index.spec.js +0 -78
@@ -1 +1,7 @@
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*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Melinda record matching modules for Javascript\n*\n* Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-record-matching-js\n*\n* melinda-record-matching-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-record-matching-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Affero General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\n// we could handle the case of books/notes\n// 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":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;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"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/match-detection/features/bib/record-type.js"],
4
+ "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"],
5
+ "mappings": "AAKA,eAAe,OAAO;AAAA,EACpB,MAAM;AAAA,EACN,SAAS,CAAC,EAAC,OAAM,MAAM,OAAO,OAAO,CAAC,IAAI,CAAC,OAAO,OAAO,CAAC,CAAC,IAAI,CAAC;AAAA,EAChE,SAAS,CAAC,GAAG,MAAM,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,MAAM;AAC3C;",
6
+ "names": []
7
+ }
@@ -1,127 +1,37 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _debug = _interopRequireDefault(require("debug"));
8
- var _matchingUtils = require("../../../matching-utils");
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
- /* 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
- // Note about validity of standardIdentifiers:
39
- // We have three types of invalid standardIdentifiers:
40
- // 1. Formally invalid standardIdentifiers (ie. typos either in the resource or the record)
41
- // 2. Formally valid standardIdentifiers that are used in a wrong resource
42
- // 3. Canceled standardIdentifiers
43
- // Matcher could and should check that a standardIdentifier found in a subfield for a valid identifier is formally valid, and if it's not formally valid, handle it as an invalid standardIdentifier
44
- // Formally valid standardIdentifiers found in subfield for invalid identifier cannot be handled as valid standardIdentifiers, because they can be a case of type 2) or 3) invalid standardIdentifiers
45
- // We could also do a separate handling for formally valid an formally invalid standardIdentifiers
46
- var _default = ({
47
- pattern,
48
- subfieldCodes,
49
- identifier,
50
- validIdentifierSubfieldCodes = ['a'],
51
- invalidIdentifierSubfieldCodes = ['z'],
52
- validatorAndNormalizer = undefined
53
- }) => {
54
- const debug = (0, _debug.default)(`@natlibfi/melinda-record-matching:match-detection:features:standard-identifiers:${identifier}`);
55
- const debugData = debug.extend('data');
56
- return {
57
- extract,
58
- compare
59
- };
60
- function extract({
61
- record,
62
- recordExternal
63
- }) {
64
- const label = recordExternal && recordExternal.label ? recordExternal.label : 'record';
1
+ import createDebugLogger from "debug";
2
+ import { extractSubfieldsFromField, uniqueSubfields } from "../../../matching-utils.js";
3
+ export default ({ pattern, subfieldCodes, identifier, validIdentifierSubfieldCodes = ["a"], invalidIdentifierSubfieldCodes = ["z"], validatorAndNormalizer = void 0 }) => {
4
+ const debug = createDebugLogger(`@natlibfi/melinda-record-matching:match-detection:features:standard-identifiers:${identifier}`);
5
+ const debugData = debug.extend("data");
6
+ return { extract, compare };
7
+ function extract({ record, recordExternal }) {
8
+ const label = recordExternal && recordExternal.label ? recordExternal.label : "record";
65
9
  const fields = record.get(pattern);
66
10
  debugData(`${label}: ${fields.length} ${identifier}-fields `);
67
-
68
- // extractIdentifierSubfield normalizes hyphens away from the subfield values
69
- const identifiersFromFields = fields.map(field => (0, _matchingUtils.extractSubfieldsFromField)(field, subfieldCodes));
11
+ const identifiersFromFields = fields.map((field) => extractSubfieldsFromField(field, subfieldCodes));
70
12
  debugData(`${label}: IDs from fields (${identifiersFromFields.length}): ${JSON.stringify(identifiersFromFields)}`);
71
13
  const allIdentifiers = identifiersFromFields.flat();
72
14
  debugData(`${label}: Flat IDs from fields (${allIdentifiers.length}): ${JSON.stringify(allIdentifiers)}`);
73
- const validatedAndNormalizedIdentifiers = validateAndNormalizeIdentifiers({
74
- identifierSubs: allIdentifiers,
75
- validatorAndNormalizer,
76
- validIdentifierSubfieldCodes,
77
- invalidIdentifierSubfieldCodes
78
- });
79
- const identifiers = (0, _matchingUtils.uniqueSubfields)(validatedAndNormalizedIdentifiers);
15
+ const validatedAndNormalizedIdentifiers = validateAndNormalizeIdentifiers({ identifierSubs: allIdentifiers, validatorAndNormalizer, validIdentifierSubfieldCodes, invalidIdentifierSubfieldCodes });
16
+ const identifiers = uniqueSubfields(validatedAndNormalizedIdentifiers);
80
17
  debugData(`${label}: Unique IDs from fields (${identifiers.length}): ${JSON.stringify(identifiers)}`);
81
18
  return identifiers;
82
- function validateAndNormalizeIdentifiers({
83
- identifierSubs,
84
- validatorAndNormalizer,
85
- validIdentifierSubfieldCodes,
86
- invalidIdentifierSubfieldCodes
87
- }) {
88
- if (validatorAndNormalizer) {
89
- return identifierSubs.map(idSub => validateAndNormalizeIdentifier({
90
- idSub,
91
- validatorAndNormalizer,
92
- validIdentifierSubfieldCodes,
93
- invalidIdentifierSubfieldCodes
94
- }));
19
+ function validateAndNormalizeIdentifiers({ identifierSubs, validatorAndNormalizer: validatorAndNormalizer2, validIdentifierSubfieldCodes: validIdentifierSubfieldCodes2, invalidIdentifierSubfieldCodes: invalidIdentifierSubfieldCodes2 }) {
20
+ if (validatorAndNormalizer2) {
21
+ return identifierSubs.map((idSub) => validateAndNormalizeIdentifier({ idSub, validatorAndNormalizer: validatorAndNormalizer2, validIdentifierSubfieldCodes: validIdentifierSubfieldCodes2, invalidIdentifierSubfieldCodes: invalidIdentifierSubfieldCodes2 }));
95
22
  }
96
- return identifierSubs.map(idSub => normalizeHyphens(idSub));
23
+ return identifierSubs.map((idSub) => normalizeHyphens(idSub));
97
24
  }
98
- function validateAndNormalizeIdentifier({
99
- idSub,
100
- validatorAndNormalizer,
101
- validIdentifierSubfieldCodes,
102
- invalidIdentifierSubfieldCodes
103
- }) {
104
- const {
105
- valid,
106
- value
107
- } = validatorAndNormalizer(idSub.value);
108
- if (validIdentifierSubfieldCodes.includes(idSub.code) && valid === false) {
109
- const [code] = invalidIdentifierSubfieldCodes;
110
- return {
111
- code,
112
- value
113
- };
25
+ function validateAndNormalizeIdentifier({ idSub, validatorAndNormalizer: validatorAndNormalizer2, validIdentifierSubfieldCodes: validIdentifierSubfieldCodes2, invalidIdentifierSubfieldCodes: invalidIdentifierSubfieldCodes2 }) {
26
+ const { valid, value } = validatorAndNormalizer2(idSub.value);
27
+ if (validIdentifierSubfieldCodes2.includes(idSub.code) && valid === false) {
28
+ const [code] = invalidIdentifierSubfieldCodes2;
29
+ return { code, value };
114
30
  }
115
- return {
116
- code: idSub.code,
117
- value
118
- };
31
+ return { code: idSub.code, value };
119
32
  }
120
33
  function normalizeHyphens(idSub) {
121
- return {
122
- code: idSub.code,
123
- value: idSub.value.replace(/-/ug, '')
124
- };
34
+ return { code: idSub.code, value: idSub.value.replace(/-/ug, "") };
125
35
  }
126
36
  }
127
37
  function compare(a, b) {
@@ -133,41 +43,25 @@ var _default = ({
133
43
  debugData(`A: ${JSON.stringify(a)}`);
134
44
  debugData(`B: ${JSON.stringify(b)}`);
135
45
  if (bothHaveValidIdentifiers()) {
136
- // Compare only valid identifiers, if both have valid idenfiers
137
- const {
138
- maxValues,
139
- possibleMatchValues,
140
- matchingValues
141
- } = getValueCount(true);
142
- if (matchingValues < 1) {
46
+ const { maxValues: maxValues2, possibleMatchValues, matchingValues: matchingValues2 } = getValueCount(true);
47
+ if (matchingValues2 < 1) {
143
48
  debug(`Both have valid standardidentifiers (${identifier}), but none of these match.`);
144
49
  return -0.75;
145
50
  }
146
- debug(`Both have valid standardidentifiers (${identifier}), ${matchingValues}/${possibleMatchValues} valid identifiers match.`);
147
- // ignore non-matches if there is mismatching amount of values
148
- debug(`Possible matches: ${possibleMatchValues}/${maxValues}`);
149
- //we give some kind of penalty for mismatching amount of values instead of simple divide?
150
- const penaltyForMissing = 0.1 * (maxValues - possibleMatchValues);
151
- const penaltyForMisMatch = 0.2 * (possibleMatchValues - matchingValues);
152
- debug(`\t points: penaltyForMissing: ${penaltyForMissing}`);
153
- debug(`\t points: penaltyForMisMatch: ${penaltyForMisMatch}`);
51
+ debug(`Both have valid standardidentifiers (${identifier}), ${matchingValues2}/${possibleMatchValues} valid identifiers match.`);
52
+ debug(`Possible matches: ${possibleMatchValues}/${maxValues2}`);
53
+ const penaltyForMissing = 0.1 * (maxValues2 - possibleMatchValues);
54
+ const penaltyForMisMatch = 0.2 * (possibleMatchValues - matchingValues2);
55
+ debug(` points: penaltyForMissing: ${penaltyForMissing}`);
56
+ debug(` points: penaltyForMisMatch: ${penaltyForMisMatch}`);
154
57
  return 0.75 - penaltyForMisMatch - penaltyForMissing;
155
- //return matchingValues / possibleMatchValues * 0.75;
156
58
  }
157
- // If both do not have valid identifiers, compare all identifiers
158
- const {
159
- maxValues,
160
- matchingValues
161
- } = getValueCount();
59
+ const { maxValues, matchingValues } = getValueCount();
162
60
  debug(`Both do NOT have valid standardidentifiers (${identifier}), ${matchingValues}/${maxValues} valid/invalid identifiers match.`);
163
61
  return matchingValues / maxValues * 0.2;
164
62
  function bothHaveValidIdentifiers() {
165
- const aValues = a.filter(({
166
- code
167
- }) => validIdentifierSubfieldCodes.includes(code));
168
- const bValues = a.filter(({
169
- code
170
- }) => validIdentifierSubfieldCodes.includes(code));
63
+ const aValues = a.filter(({ code }) => validIdentifierSubfieldCodes.includes(code));
64
+ const bValues = a.filter(({ code }) => validIdentifierSubfieldCodes.includes(code));
171
65
  debug(`A: ${aValues.length} valid ${identifier} identifiers`);
172
66
  debug(`B: ${bValues.length} valid ${identifier} identifiers`);
173
67
  return aValues.length > 0 && bValues.length > 0;
@@ -175,41 +69,31 @@ var _default = ({
175
69
  function getValueCount(validOnly = false) {
176
70
  const aValues = getIdentifiers(a, validOnly);
177
71
  const bValues = getIdentifiers(b, validOnly);
178
- const matchingValues = getMatchingValuesAmount(aValues, bValues);
72
+ const matchingValues2 = getMatchingValuesAmount(aValues, bValues);
179
73
  return {
180
74
  maxValues: aValues.length > bValues.length ? aValues.length : bValues.length,
181
75
  // possibleMatchingValues: amount of identifiers in set of less identifiers (we cannot more values than these)
182
76
  possibleMatchValues: aValues.length > bValues.length ? bValues.length : aValues.length,
183
- matchingValues
77
+ matchingValues: matchingValues2
184
78
  };
185
- function getMatchingValuesAmount(aValues, bValues) {
186
- if (bValues.length > aValues.length) {
187
- return aValues.filter(aValue => bValues.some(bValue => aValue === bValue)).length;
79
+ function getMatchingValuesAmount(aValues2, bValues2) {
80
+ if (bValues2.length > aValues2.length) {
81
+ return aValues2.filter((aValue) => bValues2.some((bValue) => aValue === bValue)).length;
188
82
  }
189
- if (aValues.length > bValues.length) {
190
- return bValues.filter(bValue => aValues.some(aValue => bValue === aValue)).length;
83
+ if (aValues2.length > bValues2.length) {
84
+ return bValues2.filter((bValue) => aValues2.some((aValue) => bValue === aValue)).length;
191
85
  }
192
-
193
- // If we have same amount of values, we'll check matches both ways, to avoid mixups in cases
194
- // there would be duplicate values
195
- const aToB = aValues.filter(aValue => bValues.some(bValue => aValue === bValue)).length;
196
- const bToA = bValues.filter(bValue => aValues.some(aValue => bValue === aValue)).length;
86
+ const aToB = aValues2.filter((aValue) => bValues2.some((bValue) => aValue === bValue)).length;
87
+ const bToA = bValues2.filter((bValue) => aValues2.some((aValue) => bValue === aValue)).length;
197
88
  return aToB < bToA ? aToB : bToA;
198
89
  }
199
- function getIdentifiers(values, validOnly) {
200
- if (validOnly) {
201
- return values.filter(({
202
- code
203
- }) => validIdentifierSubfieldCodes.includes(code)).map(({
204
- value
205
- }) => value);
90
+ function getIdentifiers(values, validOnly2) {
91
+ if (validOnly2) {
92
+ return values.filter(({ code }) => validIdentifierSubfieldCodes.includes(code)).map(({ value }) => value);
206
93
  }
207
- return values.map(({
208
- value
209
- }) => value);
94
+ return values.map(({ value }) => value);
210
95
  }
211
96
  }
212
97
  }
213
98
  };
214
- exports.default = _default;
215
- //# sourceMappingURL=standard-identifier-factory.js.map
99
+ //# sourceMappingURL=standard-identifier-factory.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"standard-identifier-factory.js","names":["_debug","_interopRequireDefault","require","_matchingUtils","obj","__esModule","default","_default","pattern","subfieldCodes","identifier","validIdentifierSubfieldCodes","invalidIdentifierSubfieldCodes","validatorAndNormalizer","undefined","debug","createDebugLogger","debugData","extend","extract","compare","record","recordExternal","label","fields","get","length","identifiersFromFields","map","field","extractSubfieldsFromField","JSON","stringify","allIdentifiers","flat","validatedAndNormalizedIdentifiers","validateAndNormalizeIdentifiers","identifierSubs","identifiers","uniqueSubfields","idSub","validateAndNormalizeIdentifier","normalizeHyphens","valid","value","includes","code","replace","a","b","bothHaveValidIdentifiers","maxValues","possibleMatchValues","matchingValues","getValueCount","penaltyForMissing","penaltyForMisMatch","aValues","filter","bValues","validOnly","getIdentifiers","getMatchingValuesAmount","aValue","some","bValue","aToB","bToA","values","exports"],"sources":["../../../../src/match-detection/features/bib/standard-identifier-factory.js"],"sourcesContent":["/* eslint-disable max-statements */\n/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Melinda record matching modules for Javascript\n*\n* Copyright (C) 2020-2022 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-record-matching-js\n*\n* melinda-record-matching-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-record-matching-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Affero General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nimport createDebugLogger from 'debug';\nimport {extractSubfieldsFromField, uniqueSubfields} from '../../../matching-utils';\n\n// Note about validity of standardIdentifiers:\n// We have three types of invalid standardIdentifiers:\n// 1. Formally invalid standardIdentifiers (ie. typos either in the resource or the record)\n// 2. Formally valid standardIdentifiers that are used in a wrong resource\n// 3. Canceled standardIdentifiers\n\n// Matcher could and should check that a standardIdentifier found in a subfield for a valid identifier is formally valid, and if it's not formally valid, handle it as an invalid standardIdentifier\n// Formally valid standardIdentifiers found in subfield for invalid identifier cannot be handled as valid standardIdentifiers, because they can be a case of type 2) or 3) invalid standardIdentifiers\n// We could also do a separate handling for formally valid an formally invalid standardIdentifiers\n\nexport default ({pattern, subfieldCodes, identifier, validIdentifierSubfieldCodes = ['a'], invalidIdentifierSubfieldCodes = ['z'], validatorAndNormalizer = undefined}) => {\n const debug = createDebugLogger(`@natlibfi/melinda-record-matching:match-detection:features:standard-identifiers:${identifier}`);\n const debugData = debug.extend('data');\n\n return {extract, compare};\n\n function extract({record, recordExternal}) {\n const label = recordExternal && recordExternal.label ? recordExternal.label : 'record';\n const fields = record.get(pattern);\n debugData(`${label}: ${fields.length} ${identifier}-fields `);\n\n // extractIdentifierSubfield normalizes hyphens away from the subfield values\n const identifiersFromFields = fields.map(field => extractSubfieldsFromField(field, subfieldCodes));\n debugData(`${label}: IDs from fields (${identifiersFromFields.length}): ${JSON.stringify(identifiersFromFields)}`);\n const allIdentifiers = identifiersFromFields.flat();\n debugData(`${label}: Flat IDs from fields (${allIdentifiers.length}): ${JSON.stringify(allIdentifiers)}`);\n\n const validatedAndNormalizedIdentifiers = validateAndNormalizeIdentifiers({identifierSubs: allIdentifiers, validatorAndNormalizer, validIdentifierSubfieldCodes, invalidIdentifierSubfieldCodes});\n\n const identifiers = uniqueSubfields(validatedAndNormalizedIdentifiers);\n\n debugData(`${label}: Unique IDs from fields (${identifiers.length}): ${JSON.stringify(identifiers)}`);\n return identifiers;\n\n function validateAndNormalizeIdentifiers({identifierSubs, validatorAndNormalizer, validIdentifierSubfieldCodes, invalidIdentifierSubfieldCodes}) {\n if (validatorAndNormalizer) {\n return identifierSubs.map((idSub) => validateAndNormalizeIdentifier({idSub, validatorAndNormalizer, validIdentifierSubfieldCodes, invalidIdentifierSubfieldCodes}));\n }\n return identifierSubs.map((idSub) => normalizeHyphens(idSub));\n }\n\n function validateAndNormalizeIdentifier({idSub, validatorAndNormalizer, validIdentifierSubfieldCodes, invalidIdentifierSubfieldCodes}) {\n const {valid, value} = validatorAndNormalizer(idSub.value);\n if (validIdentifierSubfieldCodes.includes(idSub.code) && valid === false) {\n const [code] = invalidIdentifierSubfieldCodes;\n return {code, value};\n }\n return {code: idSub.code, value};\n }\n\n function normalizeHyphens(idSub) {\n return {code: idSub.code, value: idSub.value.replace(/-/ug, '')};\n }\n\n\n }\n\n function compare(a, b) {\n debug(`Comparing A and B`);\n if (a.length === 0 || b.length === 0) {\n debugData(`No standardidentifiers (${identifier}) to compare`);\n return 0;\n }\n\n debugData(`A: ${JSON.stringify(a)}`);\n debugData(`B: ${JSON.stringify(b)}`);\n\n\n if (bothHaveValidIdentifiers()) {\n // Compare only valid identifiers, if both have valid idenfiers\n const {maxValues, possibleMatchValues, matchingValues} = getValueCount(true);\n if (matchingValues < 1) {\n debug(`Both have valid standardidentifiers (${identifier}), but none of these match.`);\n return -0.75;\n }\n debug(`Both have valid standardidentifiers (${identifier}), ${matchingValues}/${possibleMatchValues} valid identifiers 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 penaltyForMissing = 0.1 * (maxValues - possibleMatchValues);\n const penaltyForMisMatch = 0.2 * (possibleMatchValues - matchingValues);\n debug(`\\t points: penaltyForMissing: ${penaltyForMissing}`);\n debug(`\\t points: penaltyForMisMatch: ${penaltyForMisMatch}`);\n\n return 0.75 - penaltyForMisMatch - penaltyForMissing;\n //return matchingValues / possibleMatchValues * 0.75;\n }\n // If both do not have valid identifiers, compare all identifiers\n const {maxValues, matchingValues} = getValueCount();\n debug(`Both do NOT have valid standardidentifiers (${identifier}), ${matchingValues}/${maxValues} valid/invalid identifiers match.`);\n\n return matchingValues / maxValues * 0.2;\n\n function bothHaveValidIdentifiers() {\n const aValues = a.filter(({code}) => validIdentifierSubfieldCodes.includes(code));\n const bValues = a.filter(({code}) => validIdentifierSubfieldCodes.includes(code));\n debug(`A: ${aValues.length} valid ${identifier} identifiers`);\n debug(`B: ${bValues.length} valid ${identifier} identifiers`);\n return aValues.length > 0 && bValues.length > 0;\n }\n\n function getValueCount(validOnly = false) {\n const aValues = getIdentifiers(a, validOnly);\n const bValues = getIdentifiers(b, validOnly);\n\n const matchingValues = getMatchingValuesAmount(aValues, bValues);\n\n return {\n maxValues: aValues.length > bValues.length ? aValues.length : bValues.length,\n // possibleMatchingValues: amount of identifiers in set of less identifiers (we cannot more values than these)\n possibleMatchValues: aValues.length > bValues.length ? bValues.length : aValues.length,\n matchingValues\n };\n\n function getMatchingValuesAmount(aValues, bValues) {\n if (bValues.length > aValues.length) {\n return aValues.filter(aValue => bValues.some(bValue => aValue === bValue)).length;\n }\n if (aValues.length > bValues.length) {\n return bValues.filter(bValue => aValues.some(aValue => bValue === aValue)).length;\n }\n\n // If we have same amount of values, we'll check matches both ways, to avoid mixups in cases\n // there would be duplicate values\n const aToB = aValues.filter(aValue => bValues.some(bValue => aValue === bValue)).length;\n const bToA = bValues.filter(bValue => aValues.some(aValue => bValue === aValue)).length;\n\n return aToB < bToA ? aToB : bToA;\n }\n\n function getIdentifiers(values, validOnly) {\n if (validOnly) {\n return values\n .filter(({code}) => validIdentifierSubfieldCodes.includes(code))\n .map(({value}) => value);\n }\n\n return values.map(({value}) => value);\n }\n }\n }\n};\n"],"mappings":";;;;;;AA6BA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAAmF,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AA9BnF;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;AAKA;AACA;AACA;AACA;A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 "sources": ["../../../../src/match-detection/features/bib/standard-identifier-factory.js"],
4
+ "sourcesContent": ["/* eslint-disable max-statements */\n\nimport createDebugLogger from 'debug';\nimport {extractSubfieldsFromField, uniqueSubfields} from '../../../matching-utils.js';\n\n// Note about validity of standardIdentifiers:\n// We have three types of invalid standardIdentifiers:\n// 1. Formally invalid standardIdentifiers (ie. typos either in the resource or the record)\n// 2. Formally valid standardIdentifiers that are used in a wrong resource\n// 3. Canceled standardIdentifiers\n\n// Matcher could and should check that a standardIdentifier found in a subfield for a valid identifier is formally valid, and if it's not formally valid, handle it as an invalid standardIdentifier\n// Formally valid standardIdentifiers found in subfield for invalid identifier cannot be handled as valid standardIdentifiers, because they can be a case of type 2) or 3) invalid standardIdentifiers\n// We could also do a separate handling for formally valid an formally invalid standardIdentifiers\n\nexport default ({pattern, subfieldCodes, identifier, validIdentifierSubfieldCodes = ['a'], invalidIdentifierSubfieldCodes = ['z'], validatorAndNormalizer = undefined}) => {\n const debug = createDebugLogger(`@natlibfi/melinda-record-matching:match-detection:features:standard-identifiers:${identifier}`);\n const debugData = debug.extend('data');\n\n return {extract, compare};\n\n function extract({record, recordExternal}) {\n const label = recordExternal && recordExternal.label ? recordExternal.label : 'record';\n const fields = record.get(pattern);\n debugData(`${label}: ${fields.length} ${identifier}-fields `);\n\n // extractIdentifierSubfield normalizes hyphens away from the subfield values\n const identifiersFromFields = fields.map(field => extractSubfieldsFromField(field, subfieldCodes));\n debugData(`${label}: IDs from fields (${identifiersFromFields.length}): ${JSON.stringify(identifiersFromFields)}`);\n const allIdentifiers = identifiersFromFields.flat();\n debugData(`${label}: Flat IDs from fields (${allIdentifiers.length}): ${JSON.stringify(allIdentifiers)}`);\n\n const validatedAndNormalizedIdentifiers = validateAndNormalizeIdentifiers({identifierSubs: allIdentifiers, validatorAndNormalizer, validIdentifierSubfieldCodes, invalidIdentifierSubfieldCodes});\n\n const identifiers = uniqueSubfields(validatedAndNormalizedIdentifiers);\n\n debugData(`${label}: Unique IDs from fields (${identifiers.length}): ${JSON.stringify(identifiers)}`);\n return identifiers;\n\n function validateAndNormalizeIdentifiers({identifierSubs, validatorAndNormalizer, validIdentifierSubfieldCodes, invalidIdentifierSubfieldCodes}) {\n if (validatorAndNormalizer) {\n return identifierSubs.map((idSub) => validateAndNormalizeIdentifier({idSub, validatorAndNormalizer, validIdentifierSubfieldCodes, invalidIdentifierSubfieldCodes}));\n }\n return identifierSubs.map((idSub) => normalizeHyphens(idSub));\n }\n\n function validateAndNormalizeIdentifier({idSub, validatorAndNormalizer, validIdentifierSubfieldCodes, invalidIdentifierSubfieldCodes}) {\n const {valid, value} = validatorAndNormalizer(idSub.value);\n if (validIdentifierSubfieldCodes.includes(idSub.code) && valid === false) {\n const [code] = invalidIdentifierSubfieldCodes;\n return {code, value};\n }\n return {code: idSub.code, value};\n }\n\n function normalizeHyphens(idSub) {\n return {code: idSub.code, value: idSub.value.replace(/-/ug, '')};\n }\n\n\n }\n\n function compare(a, b) {\n debug(`Comparing A and B`);\n if (a.length === 0 || b.length === 0) {\n debugData(`No standardidentifiers (${identifier}) to compare`);\n return 0;\n }\n\n debugData(`A: ${JSON.stringify(a)}`);\n debugData(`B: ${JSON.stringify(b)}`);\n\n\n if (bothHaveValidIdentifiers()) {\n // Compare only valid identifiers, if both have valid idenfiers\n const {maxValues, possibleMatchValues, matchingValues} = getValueCount(true);\n if (matchingValues < 1) {\n debug(`Both have valid standardidentifiers (${identifier}), but none of these match.`);\n return -0.75;\n }\n debug(`Both have valid standardidentifiers (${identifier}), ${matchingValues}/${possibleMatchValues} valid identifiers 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 penaltyForMissing = 0.1 * (maxValues - possibleMatchValues);\n const penaltyForMisMatch = 0.2 * (possibleMatchValues - matchingValues);\n debug(`\\t points: penaltyForMissing: ${penaltyForMissing}`);\n debug(`\\t points: penaltyForMisMatch: ${penaltyForMisMatch}`);\n\n return 0.75 - penaltyForMisMatch - penaltyForMissing;\n //return matchingValues / possibleMatchValues * 0.75;\n }\n // If both do not have valid identifiers, compare all identifiers\n const {maxValues, matchingValues} = getValueCount();\n debug(`Both do NOT have valid standardidentifiers (${identifier}), ${matchingValues}/${maxValues} valid/invalid identifiers match.`);\n\n return matchingValues / maxValues * 0.2;\n\n function bothHaveValidIdentifiers() {\n const aValues = a.filter(({code}) => validIdentifierSubfieldCodes.includes(code));\n const bValues = a.filter(({code}) => validIdentifierSubfieldCodes.includes(code));\n debug(`A: ${aValues.length} valid ${identifier} identifiers`);\n debug(`B: ${bValues.length} valid ${identifier} identifiers`);\n return aValues.length > 0 && bValues.length > 0;\n }\n\n function getValueCount(validOnly = false) {\n const aValues = getIdentifiers(a, validOnly);\n const bValues = getIdentifiers(b, validOnly);\n\n const matchingValues = getMatchingValuesAmount(aValues, bValues);\n\n return {\n maxValues: aValues.length > bValues.length ? aValues.length : bValues.length,\n // possibleMatchingValues: amount of identifiers in set of less identifiers (we cannot more values than these)\n possibleMatchValues: aValues.length > bValues.length ? bValues.length : aValues.length,\n matchingValues\n };\n\n function getMatchingValuesAmount(aValues, bValues) {\n if (bValues.length > aValues.length) {\n return aValues.filter(aValue => bValues.some(bValue => aValue === bValue)).length;\n }\n if (aValues.length > bValues.length) {\n return bValues.filter(bValue => aValues.some(aValue => bValue === aValue)).length;\n }\n\n // If we have same amount of values, we'll check matches both ways, to avoid mixups in cases\n // there would be duplicate values\n const aToB = aValues.filter(aValue => bValues.some(bValue => aValue === bValue)).length;\n const bToA = bValues.filter(bValue => aValues.some(aValue => bValue === aValue)).length;\n\n return aToB < bToA ? aToB : bToA;\n }\n\n function getIdentifiers(values, validOnly) {\n if (validOnly) {\n return values\n .filter(({code}) => validIdentifierSubfieldCodes.includes(code))\n .map(({value}) => value);\n }\n\n return values.map(({value}) => value);\n }\n }\n }\n};\n"],
5
+ "mappings": "AAEA,OAAO,uBAAuB;AAC9B,SAAQ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;AAEjF,eAAO,OAAO,OAAO,OAAO;AAAA,MAC9B;AAEA,eAAS,eAAe,QAAQE,YAAW;AACzC,YAAIA,YAAW;AACb,iBAAO,OACJ,OAAO,CAAC,EAAC,KAAI,MAAM,6BAA6B,SAAS,IAAI,CAAC,EAC9D,IAAI,CAAC,EAAC,MAAK,MAAM,KAAK;AAAA,QAC3B;AAEA,eAAO,OAAO,IAAI,CAAC,EAAC,MAAK,MAAM,KAAK;AAAA,MACtC;AAAA,IACF;AAAA,EACF;AACF;",
6
+ "names": ["validatorAndNormalizer", "validIdentifierSubfieldCodes", "invalidIdentifierSubfieldCodes", "maxValues", "matchingValues", "aValues", "bValues", "validOnly"]
7
+ }
@@ -1,65 +1,24 @@
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 _natural = require("natural");
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
- var _default = ({
38
- treshold = 10
39
- } = {}) => ({
40
- name: 'titleVersionOriginal',
41
- extract: ({
42
- record
43
- }) => {
1
+ import createDebugLogger from "debug";
2
+ import naturalPkg from "natural";
3
+ const { LevenshteinDistance: leven } = naturalPkg;
4
+ export default ({ treshold = 10 } = {}) => ({
5
+ name: "titleVersionOriginal",
6
+ extract: ({ record }) => {
44
7
  const title = getTitle();
45
8
  if (title) {
46
- return [title.replace(/[^\p{Letter}\p{Number}]/gu, '').toLowerCase()];
9
+ return [title.replace(/[^\p{Letter}\p{Number}]/gu, "").toLowerCase()];
47
10
  }
48
11
  return [];
49
12
  function getTitle() {
50
13
  const [field] = record.get(/^245$/u);
51
14
  if (field) {
52
- return field.subfields.filter(({
53
- code
54
- }) => ['a', 'b'].includes(code)).map(({
55
- value
56
- }) => value).join('');
15
+ return field.subfields.filter(({ code }) => ["a", "b"].includes(code)).map(({ value }) => value).join("");
57
16
  }
58
17
  }
59
18
  },
60
19
  compare: (a, b) => {
61
- const debug = (0, _debug.default)('@natlibfi/melinda-record-matching:match-detection:features/bib/title-version-original');
62
- const distance = (0, _natural.LevenshteinDistance)(a[0], b[0]);
20
+ const debug = createDebugLogger("@natlibfi/melinda-record-matching:match-detection:features/bib/title-version-original");
21
+ const distance = leven(a[0], b[0]);
63
22
  if (distance === 0) {
64
23
  return 0.5;
65
24
  }
@@ -75,5 +34,4 @@ var _default = ({
75
34
  }
76
35
  }
77
36
  });
78
- exports.default = _default;
79
- //# sourceMappingURL=title-version-original.js.map
37
+ //# sourceMappingURL=title-version-original.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"title-version-original.js","names":["_debug","_interopRequireDefault","require","_natural","obj","__esModule","default","_default","treshold","name","extract","record","title","getTitle","replace","toLowerCase","field","get","subfields","filter","code","includes","map","value","join","compare","a","b","debug","createDebugLogger","distance","leven","maxLength","getMaxLength","percentage","length","exports"],"sources":["../../../../src/match-detection/features/bib/title-version-original.js"],"sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Melinda record matching modules for Javascript\n*\n* Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-record-matching-js\n*\n* melinda-record-matching-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-record-matching-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Affero General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nimport createDebugLogger from 'debug';\nimport {LevenshteinDistance as leven} from 'natural';\n\nexport default ({treshold = 10} = {}) => ({\n name: 'titleVersionOriginal',\n extract: ({record}) => {\n const title = getTitle();\n\n if (title) {\n return [title.replace(/[^\\p{Letter}\\p{Number}]/gu, '').toLowerCase()];\n }\n\n return [];\n\n function getTitle() {\n const [field] = record.get(/^245$/u);\n\n if (field) {\n return field.subfields\n .filter(({code}) => ['a', 'b'].includes(code))\n .map(({value}) => value)\n .join('');\n }\n }\n },\n compare: (a, b) => {\n const debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features/bib/title-version-original');\n const distance = leven(a[0], b[0]);\n\n if (distance === 0) {\n return 0.5;\n }\n\n const maxLength = getMaxLength();\n const percentage = distance / maxLength * 100;\n\n debug(`'${a}' vs '${b}': Max length = ${maxLength}, distance = ${distance}, percentage = ${percentage}`);\n\n if (percentage <= treshold) {\n return 0.3;\n }\n\n return -0.5;\n\n function getMaxLength() {\n return a[0].length > b[0].length ? a[0].length : b[0].length;\n }\n\n }\n});\n"],"mappings":";;;;;;AA4BA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAAqD,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAA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EA,MAAME,SAAS,GAAGC,YAAY,CAAC,CAAC;IAChC,MAAMC,UAAU,GAAGJ,QAAQ,GAAGE,SAAS,GAAG,GAAG;IAE7CJ,KAAK,CAAE,IAAGF,CAAE,SAAQC,CAAE,mBAAkBK,SAAU,gBAAeF,QAAS,kBAAiBI,UAAW,EAAC,CAAC;IAExG,IAAIA,UAAU,IAAI1B,QAAQ,EAAE;MAC1B,OAAO,GAAG;IACZ;IAEA,OAAO,CAAC,GAAG;IAEX,SAASyB,YAAYA,CAAA,EAAG;MACtB,OAAOP,CAAC,CAAC,CAAC,CAAC,CAACS,MAAM,GAAGR,CAAC,CAAC,CAAC,CAAC,CAACQ,MAAM,GAAGT,CAAC,CAAC,CAAC,CAAC,CAACS,MAAM,GAAGR,CAAC,CAAC,CAAC,CAAC,CAACQ,MAAM;IAC9D;EAEF;AACF,CAAC,CAAC;AAAAC,OAAA,CAAA9B,OAAA,GAAAC,QAAA"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/match-detection/features/bib/title-version-original.js"],
4
+ "sourcesContent": ["\nimport createDebugLogger from 'debug';\nimport naturalPkg from 'natural';\nconst {LevenshteinDistance: leven} = naturalPkg;\n\nexport default ({treshold = 10} = {}) => ({\n name: 'titleVersionOriginal',\n extract: ({record}) => {\n const title = getTitle();\n\n if (title) {\n return [title.replace(/[^\\p{Letter}\\p{Number}]/gu, '').toLowerCase()];\n }\n\n return [];\n\n function getTitle() {\n const [field] = record.get(/^245$/u);\n\n if (field) {\n return field.subfields\n .filter(({code}) => ['a', 'b'].includes(code))\n .map(({value}) => value)\n .join('');\n }\n }\n },\n compare: (a, b) => {\n const debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features/bib/title-version-original');\n const distance = leven(a[0], b[0]);\n\n if (distance === 0) {\n return 0.5;\n }\n\n const maxLength = getMaxLength();\n const percentage = distance / maxLength * 100;\n\n debug(`'${a}' vs '${b}': Max length = ${maxLength}, distance = ${distance}, percentage = ${percentage}`);\n\n if (percentage <= treshold) {\n return 0.3;\n }\n\n return -0.5;\n\n function getMaxLength() {\n return a[0].length > b[0].length ? a[0].length : b[0].length;\n }\n\n }\n});\n"],
5
+ "mappings": "AACA,OAAO,uBAAuB;AAC9B,OAAO,gBAAgB;AACvB,MAAM,EAAC,qBAAqB,MAAK,IAAI;AAErC,eAAe,CAAC,EAAC,WAAW,GAAE,IAAI,CAAC,OAAO;AAAA,EACxC,MAAM;AAAA,EACN,SAAS,CAAC,EAAC,OAAM,MAAM;AACrB,UAAM,QAAQ,SAAS;AAEvB,QAAI,OAAO;AACT,aAAO,CAAC,MAAM,QAAQ,6BAA6B,EAAE,EAAE,YAAY,CAAC;AAAA,IACtE;AAEA,WAAO,CAAC;AAER,aAAS,WAAW;AAClB,YAAM,CAAC,KAAK,IAAI,OAAO,IAAI,QAAQ;AAEnC,UAAI,OAAO;AACT,eAAO,MAAM,UACV,OAAO,CAAC,EAAC,KAAI,MAAM,CAAC,KAAK,GAAG,EAAE,SAAS,IAAI,CAAC,EAC5C,IAAI,CAAC,EAAC,MAAK,MAAM,KAAK,EACtB,KAAK,EAAE;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAAA,EACA,SAAS,CAAC,GAAG,MAAM;AACjB,UAAM,QAAQ,kBAAkB,uFAAuF;AACvH,UAAM,WAAW,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;AAEjC,QAAI,aAAa,GAAG;AAClB,aAAO;AAAA,IACT;AAEA,UAAM,YAAY,aAAa;AAC/B,UAAM,aAAa,WAAW,YAAY;AAE1C,UAAM,IAAI,CAAC,SAAS,CAAC,mBAAmB,SAAS,gBAAgB,QAAQ,kBAAkB,UAAU,EAAE;AAEvG,QAAI,cAAc,UAAU;AAC1B,aAAO;AAAA,IACT;AAEA,WAAO;AAEP,aAAS,eAAe;AACtB,aAAO,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE;AAAA,IACxD;AAAA,EAEF;AACF;",
6
+ "names": []
7
+ }
@@ -1,90 +1,39 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _natural = require("natural");
8
- var _matchingUtils = require("../../../matching-utils");
9
- var _debug = _interopRequireDefault(require("debug"));
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
- /**
12
- *
13
- * @licstart The following is the entire license notice for the JavaScript code in this file.
14
- *
15
- * Melinda record matching modules for Javascript
16
- *
17
- * Copyright (C) 2020-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
-
39
- const debug = (0, _debug.default)('@natlibfi/melinda-record-matching:match-detection:features:title');
40
- const debugData = debug.extend('data');
41
- var _default = ({
42
- treshold = 10
43
- } = {}) => ({
44
- name: 'Title',
45
- extract: ({
46
- record,
47
- recordExternal
48
- }) => {
49
- const label = recordExternal && recordExternal.label ? recordExternal.label : 'record';
1
+ import createDebugLogger from "debug";
2
+ import naturalPkg from "natural";
3
+ const { LevenshteinDistance: leven } = naturalPkg;
4
+ import { testStringOrNumber } from "../../../matching-utils.js";
5
+ const debug = createDebugLogger("@natlibfi/melinda-record-matching:match-detection:features:title");
6
+ const debugData = debug.extend("data");
7
+ export default ({ treshold = 10 } = {}) => ({
8
+ name: "Title",
9
+ extract: ({ record, recordExternal }) => {
10
+ const label = recordExternal && recordExternal.label ? recordExternal.label : "record";
50
11
  const title = getTitle();
51
- debug(`${label} title: ${title}`);
52
- if ((0, _matchingUtils.testStringOrNumber)(title)) {
53
- const titleAsNormalizedString = String(title)
54
- // decompose unicode diacritics
55
- .normalize('NFD')
56
- // strip non-letters/numbers
57
- // - note: combined with decomposing unicode diactics this normalizes both 'saa' and 'sää' as 'saa'
58
- // - we could precompose the finnish letters back to avoid this
59
- .replace(/[^\p{Letter}\p{Number}]/gu, '').toLowerCase();
60
- debug(`${label} titleString: ${titleAsNormalizedString}`);
12
+ debug(`${label}: title: ${title}`);
13
+ if (testStringOrNumber(title)) {
14
+ const titleAsNormalizedString = String(title).normalize("NFD").replace(/[^\p{Letter}\p{Number}]/gu, "").toLowerCase();
15
+ debug(`${label}: titleString: ${titleAsNormalizedString}`);
61
16
  return [titleAsNormalizedString];
62
17
  }
63
18
  return [];
64
19
  function getTitle() {
65
20
  const [field] = record.get(/^245$/u);
66
- debugData(`${label} titleField: ${JSON.stringify(field)}`);
21
+ debugData(`${label}: titleField: ${JSON.stringify(field)}`);
67
22
  if (field) {
68
- return field.subfields
69
- // get also $n:s and $p:s here
70
- .filter(({
71
- code
72
- }) => ['a', 'b', 'n', 'p'].includes(code)).map(({
73
- value
74
- }) => (0, _matchingUtils.testStringOrNumber)(value) ? String(value) : '').join('');
23
+ return field.subfields.filter(({ code }) => ["a", "b", "n", "p"].includes(code)).map(({ value }) => testStringOrNumber(value) ? String(value) : "").join("");
75
24
  }
76
25
  return false;
77
26
  }
78
27
  },
79
28
  compare: (a, b) => {
80
- const debug = (0, _debug.default)('@natlibfi/melinda-record-matching:match-detection:features/bib/title');
81
- const distance = (0, _natural.LevenshteinDistance)(a[0], b[0]);
29
+ const debug2 = createDebugLogger("@natlibfi/melinda-record-matching:match-detection:features/bib/title");
30
+ const distance = leven(a[0], b[0]);
82
31
  if (distance === 0) {
83
32
  return 0.5;
84
33
  }
85
34
  const maxLength = getMaxLength();
86
35
  const percentage = distance / maxLength * 100;
87
- debug(`'${a}' vs '${b}': Max length = ${maxLength}, distance = ${distance}, percentage = ${percentage}`);
36
+ debug2(`'${a}' vs '${b}': Max length = ${maxLength}, distance = ${distance}, percentage = ${percentage}`);
88
37
  if (percentage <= treshold) {
89
38
  return 0.3;
90
39
  }
@@ -94,5 +43,4 @@ var _default = ({
94
43
  }
95
44
  }
96
45
  });
97
- exports.default = _default;
98
- //# sourceMappingURL=title.js.map
46
+ //# sourceMappingURL=title.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"title.js","names":["_natural","require","_matchingUtils","_debug","_interopRequireDefault","obj","__esModule","default","debug","createDebugLogger","debugData","extend","_default","treshold","name","extract","record","recordExternal","label","title","getTitle","testStringOrNumber","titleAsNormalizedString","String","normalize","replace","toLowerCase","field","get","JSON","stringify","subfields","filter","code","includes","map","value","join","compare","a","b","distance","leven","maxLength","getMaxLength","percentage","length","exports"],"sources":["../../../../src/match-detection/features/bib/title.js"],"sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Melinda record matching modules for Javascript\n*\n* Copyright (C) 2020-2022 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-record-matching-js\n*\n* melinda-record-matching-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-record-matching-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Affero General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\n\nimport {LevenshteinDistance as leven} from 'natural';\nimport {testStringOrNumber} from '../../../matching-utils';\nimport createDebugLogger from 'debug';\n\nconst debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features:title');\nconst debugData = debug.extend('data');\n\n\nexport default ({treshold = 10} = {}) => ({\n name: 'Title',\n extract: ({record, recordExternal}) => {\n const label = recordExternal && recordExternal.label ? recordExternal.label : 'record';\n const title = getTitle();\n debug(`${label} title: ${title}`);\n\n if (testStringOrNumber(title)) {\n const titleAsNormalizedString = String(title)\n // decompose unicode diacritics\n .normalize('NFD')\n // strip non-letters/numbers\n // - note: combined with decomposing unicode diactics this normalizes both 'saa' and 'sää' as 'saa'\n // - we could precompose the finnish letters back to avoid this\n .replace(/[^\\p{Letter}\\p{Number}]/gu, '')\n .toLowerCase();\n debug(`${label} titleString: ${titleAsNormalizedString}`);\n return [titleAsNormalizedString];\n }\n\n return [];\n\n function getTitle() {\n const [field] = record.get(/^245$/u);\n debugData(`${label} titleField: ${JSON.stringify(field)}`);\n\n if (field) {\n return field.subfields\n // get also $n:s and $p:s here\n .filter(({code}) => ['a', 'b', 'n', 'p'].includes(code))\n .map(({value}) => testStringOrNumber(value) ? String(value) : '')\n .join('');\n }\n return false;\n }\n },\n compare: (a, b) => {\n const debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features/bib/title');\n const distance = leven(a[0], b[0]);\n\n if (distance === 0) {\n return 0.5;\n }\n\n const maxLength = getMaxLength();\n const percentage = distance / maxLength * 100;\n\n debug(`'${a}' vs '${b}': Max length = ${maxLength}, distance = ${distance}, percentage = ${percentage}`);\n\n if (percentage <= treshold) {\n return 0.3;\n }\n\n return -0.5;\n\n function getMaxLength() {\n return a[0].length > b[0].length ? a[0].length : b[0].length;\n }\n\n }\n});\n"],"mappings":";;;;;;AA6BA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AAAsC,SAAAG,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,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AAAAC,OAAA,CAAAxC,OAAA,GAAAK,QAAA"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/match-detection/features/bib/title.js"],
4
+ "sourcesContent": ["import createDebugLogger from 'debug';\nimport naturalPkg from 'natural';\nconst {LevenshteinDistance: leven} = naturalPkg;\nimport {testStringOrNumber} from '../../../matching-utils.js';\n\nconst debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features:title');\nconst debugData = debug.extend('data');\n\n\nexport default ({treshold = 10} = {}) => ({\n name: 'Title',\n extract: ({record, recordExternal}) => {\n const label = recordExternal && recordExternal.label ? recordExternal.label : 'record';\n const title = getTitle();\n debug(`${label}: title: ${title}`);\n\n if (testStringOrNumber(title)) {\n const titleAsNormalizedString = String(title)\n // decompose unicode diacritics\n .normalize('NFD')\n // strip non-letters/numbers\n // - note: combined with decomposing unicode diactics this normalizes both 'saa' and 's\u00E4\u00E4' as 'saa'\n // - we could precompose the finnish letters back to avoid this\n .replace(/[^\\p{Letter}\\p{Number}]/gu, '')\n .toLowerCase();\n debug(`${label}: titleString: ${titleAsNormalizedString}`);\n return [titleAsNormalizedString];\n }\n\n return [];\n\n function getTitle() {\n const [field] = record.get(/^245$/u);\n debugData(`${label}: titleField: ${JSON.stringify(field)}`);\n\n if (field) {\n return field.subfields\n // get also $n:s and $p:s here\n .filter(({code}) => ['a', 'b', 'n', 'p'].includes(code))\n .map(({value}) => testStringOrNumber(value) ? String(value) : '')\n .join('');\n }\n return false;\n }\n },\n compare: (a, b) => {\n const debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features/bib/title');\n const distance = leven(a[0], b[0]);\n\n if (distance === 0) {\n return 0.5;\n }\n\n const maxLength = getMaxLength();\n const percentage = distance / maxLength * 100;\n\n debug(`'${a}' vs '${b}': Max length = ${maxLength}, distance = ${distance}, percentage = ${percentage}`);\n\n if (percentage <= treshold) {\n return 0.3;\n }\n\n return -0.5;\n\n function getMaxLength() {\n return a[0].length > b[0].length ? a[0].length : b[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AAa,GAAG;AAClB,aAAO;AAAA,IACT;AAEA,UAAM,YAAY,aAAa;AAC/B,UAAM,aAAa,WAAW,YAAY;AAE1C,IAAAA,OAAM,IAAI,CAAC,SAAS,CAAC,mBAAmB,SAAS,gBAAgB,QAAQ,kBAAkB,UAAU,EAAE;AAEvG,QAAI,cAAc,UAAU;AAC1B,aAAO;AAAA,IACT;AAEA,WAAO;AAEP,aAAS,eAAe;AACtB,aAAO,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE;AAAA,IACxD;AAAA,EAEF;AACF;",
6
+ "names": ["debug"]
7
+ }
@@ -1,11 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.bib = void 0;
7
- var bib = _interopRequireWildcard(require("./bib"));
8
- exports.bib = bib;
9
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
10
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
11
- //# sourceMappingURL=index.js.map
1
+ import * as bib from "./bib/index.js";
2
+ export { bib };
3
+ //# sourceMappingURL=index.js.map