@natlibfi/melinda-record-matching 2.2.2 → 3.0.1-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 (66) hide show
  1. package/dist/candidate-search/index.js +0 -4
  2. package/dist/candidate-search/index.js.map +1 -1
  3. package/dist/candidate-search/index.spec.js +1 -5
  4. package/dist/candidate-search/index.spec.js.map +1 -1
  5. package/dist/candidate-search/query-list/bib.js +0 -2
  6. package/dist/candidate-search/query-list/bib.js.map +1 -1
  7. package/dist/index.js +20 -4
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.spec.js +3 -1
  10. package/dist/index.spec.js.map +1 -1
  11. package/dist/match-detection/features/bib/all-source-ids.js +6 -3
  12. package/dist/match-detection/features/bib/all-source-ids.js.map +1 -1
  13. package/dist/match-detection/features/bib/authors.js +28 -22
  14. package/dist/match-detection/features/bib/authors.js.map +1 -1
  15. package/dist/match-detection/features/bib/bibliographic-level.js +5 -2
  16. package/dist/match-detection/features/bib/bibliographic-level.js.map +1 -1
  17. package/dist/match-detection/features/bib/host-component.js +5 -2
  18. package/dist/match-detection/features/bib/host-component.js.map +1 -1
  19. package/dist/match-detection/features/bib/index.spec.js +3 -2
  20. package/dist/match-detection/features/bib/index.spec.js.map +1 -1
  21. package/dist/match-detection/features/bib/isbn.js +2 -1
  22. package/dist/match-detection/features/bib/isbn.js.map +1 -1
  23. package/dist/match-detection/features/bib/issn.js +2 -1
  24. package/dist/match-detection/features/bib/issn.js.map +1 -1
  25. package/dist/match-detection/features/bib/language.js +12 -8
  26. package/dist/match-detection/features/bib/language.js.map +1 -1
  27. package/dist/match-detection/features/bib/melinda-id.js +2 -1
  28. package/dist/match-detection/features/bib/melinda-id.js.map +1 -1
  29. package/dist/match-detection/features/bib/melinda-identifier-factory.js +5 -4
  30. package/dist/match-detection/features/bib/melinda-identifier-factory.js.map +1 -1
  31. package/dist/match-detection/features/bib/other-standard-identifier.js +2 -1
  32. package/dist/match-detection/features/bib/other-standard-identifier.js.map +1 -1
  33. package/dist/match-detection/features/bib/publication-time.js +3 -1
  34. package/dist/match-detection/features/bib/publication-time.js.map +1 -1
  35. package/dist/match-detection/features/bib/record-type.js +3 -1
  36. package/dist/match-detection/features/bib/record-type.js.map +1 -1
  37. package/dist/match-detection/features/bib/standard-identifier-factory.js +3 -1
  38. package/dist/match-detection/features/bib/standard-identifier-factory.js.map +1 -1
  39. package/dist/match-detection/features/bib/title.js +26 -6
  40. package/dist/match-detection/features/bib/title.js.map +1 -1
  41. package/dist/match-detection/index.js +54 -15
  42. package/dist/match-detection/index.js.map +1 -1
  43. package/dist/match-detection/index.spec.js +4 -1
  44. package/dist/match-detection/index.spec.js.map +1 -1
  45. package/dist/matching-utils.js +0 -2
  46. package/dist/matching-utils.js.map +1 -1
  47. package/package.json +8 -8
  48. package/src/candidate-search/index.js +1 -3
  49. package/src/candidate-search/index.spec.js +1 -3
  50. package/src/candidate-search/query-list/bib.js +0 -1
  51. package/src/index.js +5 -4
  52. package/src/index.spec.js +1 -1
  53. package/src/match-detection/features/bib/all-source-ids.js +3 -3
  54. package/src/match-detection/features/bib/authors.js +19 -15
  55. package/src/match-detection/features/bib/bibliographic-level.js +1 -1
  56. package/src/match-detection/features/bib/host-component.js +1 -1
  57. package/src/match-detection/features/bib/index.spec.js +2 -2
  58. package/src/match-detection/features/bib/language.js +10 -8
  59. package/src/match-detection/features/bib/melinda-identifier-factory.js +2 -3
  60. package/src/match-detection/features/bib/publication-time.js +1 -1
  61. package/src/match-detection/features/bib/record-type.js +1 -1
  62. package/src/match-detection/features/bib/standard-identifier-factory.js +1 -1
  63. package/src/match-detection/features/bib/title.js +22 -4
  64. package/src/match-detection/index.js +23 -15
  65. package/src/match-detection/index.spec.js +1 -1
  66. package/src/matching-utils.js +0 -1
@@ -7,7 +7,6 @@ exports.default = void 0;
7
7
  var _debug = _interopRequireDefault(require("debug"));
8
8
  var _matchingUtils = require("../../../matching-utils");
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
- /* eslint-disable max-statements */
11
10
  /**
12
11
  *
13
12
  * @licstart The following is the entire license notice for the JavaScript code in this file.
@@ -61,8 +60,12 @@ Records with matching local ids for matching local db are a very good match.
61
60
  */
62
61
  var _default = () => ({
63
62
  name: 'All source IDs',
64
- extract: record => {
65
- debug(`Creating match detection features for all local source id's`);
63
+ extract: ({
64
+ record,
65
+ recordExternal
66
+ }) => {
67
+ const label = recordExternal && recordExternal.label ? recordExternal.label : 'record';
68
+ debug(`Creating match detection features for all local source id's for ${label}`);
66
69
  const fSids = record.get('SID');
67
70
  debugData(`SID-fields (${fSids.length}): ${JSON.stringify(fSids)}`);
68
71
  const sidFeatures = getSidFeatures(fSids);
@@ -1 +1 @@
1
- {"version":3,"file":"all-source-ids.js","names":["debug","createDebugLogger","debugData","extend","name","extract","record","fSids","get","length","JSON","stringify","sidFeatures","getSidFeatures","map","toSidFeature","filter","nonEmptySid","field","validateSidFieldSubfieldCounts","createSidFeature","sfC","getSubfieldValues","sfB","compare","a","b","matches","sidA","some","sidB","sourceDb","sourceId","mismatches"],"sources":["../../../../src/match-detection/features/bib/all-source-ids.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 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 {validateSidFieldSubfieldCounts, getSubfieldValues} from '../../../matching-utils';\n\nconst debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features:all-source-ids');\nconst debugData = debug.extend('data');\n\n/*\n\nSID-fields in Melinda have sf $c with local id and sf $b with a code for the local db:\n\n SID__ $c 123457 $b helka\n SID__ $c (ANDL100020)1077305 $b sata\n SID__ $c VER999999 $ FI-KV\n\nallSourceIds matching feature is formatted as [{sourceDb: \"helka\", sourceId: \"123457\"}, {sourceDb: \"sata\", sourceId: \"(ANDL100020)1077305\"}, {sourceDb: \"FI-KV\", sourceId: \"VER999999\"}]\n- no normalization / prefix deletions etc. in the feature\n\nNote: All Melinda records that have a matching records in a local db do NOT have SID for that local records,\n existence of a SID field depends on how the record has been added to Melinda and how it has been handled\n afterwards. SIDs are also not reliably maintained. A record might or might not have a SID for a local db\n after the matching record is removed from the local db.\n\nRecords with mismatching local ids for matching local db are a strong mismatch.\nRecords with matching local ids for matching local db are a very good match.\n\n*/\n\nexport default () => ({\n name: 'All source IDs',\n extract: record => {\n debug(`Creating match detection features for all local source id's`);\n\n const fSids = record.get('SID');\n debugData(`SID-fields (${fSids.length}): ${JSON.stringify(fSids)}`);\n\n const sidFeatures = getSidFeatures(fSids);\n debugData(`SID-features (${sidFeatures.length}): ${JSON.stringify(sidFeatures)}`);\n\n return sidFeatures;\n\n function getSidFeatures(fSids) {\n debug(`Getting Sid strings from SID fields`);\n\n // Map SID fields to sidFeatures, filter out empty strings\n const sidFeatures = fSids.map(toSidFeature).filter(nonEmptySid => nonEmptySid);\n return sidFeatures;\n\n function toSidFeature(field) {\n debug(`Getting feature from a field`);\n\n return validateSidFieldSubfieldCounts(field) ? createSidFeature(field) : '';\n\n function createSidFeature(field) {\n debug(`Creating feature from a field`);\n const [sfC] = getSubfieldValues(field, 'c');\n const [sfB] = getSubfieldValues(field, 'b');\n\n debugData(`${JSON.stringify(sfC)} + ${JSON.stringify(sfB)}`);\n debugData(`sourceDb: ${sfB}, sourceId: ${sfC}`);\n return {'sourceDb': sfB, 'sourceId': sfC};\n }\n }\n\n }\n\n },\n compare: (a, b) => {\n\n debugData(`Comparing ${JSON.stringify(a)} and ${JSON.stringify(b)}`);\n\n const matches = a.filter(sidA => b.some(sidB => sidA.sourceDb === sidB.sourceDb &&\n sidA.sourceId === sidB.sourceId));\n debugData(`Matches (${matches.length}): ${JSON.stringify(matches)}`);\n\n const mismatches = a.filter(sidA => b.some(sidB => sidA.sourceDb === sidB.sourceDb &&\n sidA.sourceId !== sidB.sourceId));\n debugData(`Mismatches (${mismatches.length}): ${JSON.stringify(mismatches)}`);\n\n // If there's at least one mismatching source ID from matching source db\n if (mismatches.length > 0) {\n return -1;\n }\n\n // If there's at least one matching source ID from matching source db\n if (matches.length > 0) {\n return 1;\n }\n\n // If there are no source IDs with matching sources\n return 0;\n\n }\n});\n"],"mappings":";;;;;;AA6BA;AACA;AAA0F;AA9B1F;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,MAAMA,KAAK,GAAG,IAAAC,cAAiB,EAAC,2EAA2E,CAAC;AAC5G,MAAMC,SAAS,GAAGF,KAAK,CAACG,MAAM,CAAC,MAAM,CAAC;;AAEtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnBA,eAqBe,OAAO;EACpBC,IAAI,EAAE,gBAAgB;EACtBC,OAAO,EAAEC,MAAM,IAAI;IACjBN,KAAK,CAAE,6DAA4D,CAAC;IAEpE,MAAMO,KAAK,GAAGD,MAAM,CAACE,GAAG,CAAC,KAAK,CAAC;IAC/BN,SAAS,CAAE,eAAcK,KAAK,CAACE,MAAO,MAAKC,IAAI,CAACC,SAAS,CAACJ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SAAS,CAACe,CAAC,CAAE,EAAC,CAAC;IAEpE,MAAMC,OAAO,GAAGF,CAAC,CAACT,MAAM,CAACY,IAAI,IAAIF,CAAC,CAACG,IAAI,CAACC,IAAI,IAAIF,IAAI,CAACG,QAAQ,KAAKD,IAAI,CAACC,QAAQ,IACvEH,IAAI,CAACI,QAAQ,KAAKF,IAAI,CAACE,QAAQ,CAAC,CAAC;IACzC9B,SAAS,CAAE,YAAWyB,OAAO,CAAClB,MAAO,MAAKC,IAAI,CAACC,SAAS,CAACgB,OAAO,CAAE,EAAC,CAAC;IAEpE,MAAMM,UAAU,GAAGR,CAAC,CAACT,MAAM,CAACY,IAAI,IAAIF,CAAC,CAACG,IAAI,CAACC,IAAI,IAAIF,IAAI,CAACG,QAAQ,KAAKD,IAAI,CAACC,QAAQ,IAChFH,IAAI,CAACI,QAAQ,KAAKF,IAAI,CAACE,QAAQ,CAAC,CAAC;IACnC9B,SAAS,CAAE,eAAc+B,UAAU,CAACxB,MAAO,MAAKC,IAAI,CAACC,SAAS,CAACsB,UAAU,CAAE,EAAC,CAAC;;IAE7E;IACA,IAAIA,UAAU,CAACxB,MAAM,GAAG,CAAC,EAAE;MACzB,OAAO,CAAC,CAAC;IACX;;IAEA;IACA,IAAIkB,OAAO,CAAClB,MAAM,GAAG,CAAC,EAAE;MACtB,OAAO,CAAC;IACV;;IAEA;IACA,OAAO,CAAC;EAEV;AACF,CAAC,CAAC;AAAA"}
1
+ {"version":3,"file":"all-source-ids.js","names":["debug","createDebugLogger","debugData","extend","name","extract","record","recordExternal","label","fSids","get","length","JSON","stringify","sidFeatures","getSidFeatures","map","toSidFeature","filter","nonEmptySid","field","validateSidFieldSubfieldCounts","createSidFeature","sfC","getSubfieldValues","sfB","compare","a","b","matches","sidA","some","sidB","sourceDb","sourceId","mismatches"],"sources":["../../../../src/match-detection/features/bib/all-source-ids.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 {validateSidFieldSubfieldCounts, getSubfieldValues} from '../../../matching-utils';\n\nconst debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features:all-source-ids');\nconst debugData = debug.extend('data');\n\n/*\n\nSID-fields in Melinda have sf $c with local id and sf $b with a code for the local db:\n\n SID__ $c 123457 $b helka\n SID__ $c (ANDL100020)1077305 $b sata\n SID__ $c VER999999 $ FI-KV\n\nallSourceIds matching feature is formatted as [{sourceDb: \"helka\", sourceId: \"123457\"}, {sourceDb: \"sata\", sourceId: \"(ANDL100020)1077305\"}, {sourceDb: \"FI-KV\", sourceId: \"VER999999\"}]\n- no normalization / prefix deletions etc. in the feature\n\nNote: All Melinda records that have a matching records in a local db do NOT have SID for that local records,\n existence of a SID field depends on how the record has been added to Melinda and how it has been handled\n afterwards. SIDs are also not reliably maintained. A record might or might not have a SID for a local db\n after the matching record is removed from the local db.\n\nRecords with mismatching local ids for matching local db are a strong mismatch.\nRecords with matching local ids for matching local db are a very good match.\n\n*/\n\nexport default () => ({\n name: 'All source IDs',\n extract: ({record, recordExternal}) => {\n const label = recordExternal && recordExternal.label ? recordExternal.label : 'record';\n debug(`Creating match detection features for all local source id's for ${label}`);\n\n const fSids = record.get('SID');\n debugData(`SID-fields (${fSids.length}): ${JSON.stringify(fSids)}`);\n\n const sidFeatures = getSidFeatures(fSids);\n debugData(`SID-features (${sidFeatures.length}): ${JSON.stringify(sidFeatures)}`);\n\n return sidFeatures;\n\n function getSidFeatures(fSids) {\n debug(`Getting Sid strings from SID fields`);\n\n // Map SID fields to sidFeatures, filter out empty strings\n const sidFeatures = fSids.map(toSidFeature).filter(nonEmptySid => nonEmptySid);\n return sidFeatures;\n\n function toSidFeature(field) {\n debug(`Getting feature from a field`);\n\n return validateSidFieldSubfieldCounts(field) ? createSidFeature(field) : '';\n\n function createSidFeature(field) {\n debug(`Creating feature from a field`);\n const [sfC] = getSubfieldValues(field, 'c');\n const [sfB] = getSubfieldValues(field, 'b');\n\n debugData(`${JSON.stringify(sfC)} + ${JSON.stringify(sfB)}`);\n debugData(`sourceDb: ${sfB}, sourceId: ${sfC}`);\n return {'sourceDb': sfB, 'sourceId': sfC};\n }\n }\n\n }\n\n },\n compare: (a, b) => {\n\n debugData(`Comparing ${JSON.stringify(a)} and ${JSON.stringify(b)}`);\n\n const matches = a.filter(sidA => b.some(sidB => sidA.sourceDb === sidB.sourceDb &&\n sidA.sourceId === sidB.sourceId));\n debugData(`Matches (${matches.length}): ${JSON.stringify(matches)}`);\n\n const mismatches = a.filter(sidA => b.some(sidB => sidA.sourceDb === sidB.sourceDb &&\n sidA.sourceId !== sidB.sourceId));\n debugData(`Mismatches (${mismatches.length}): ${JSON.stringify(mismatches)}`);\n\n // If there's at least one mismatching source ID from matching source db\n if (mismatches.length > 0) {\n return -1;\n }\n\n // If there's at least one matching source ID from matching source db\n if (matches.length > 0) {\n return 1;\n }\n\n // If there are no source IDs with matching sources\n return 0;\n\n }\n});\n"],"mappings":";;;;;;AA4BA;AACA;AAA0F;AA7B1F;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,MAAMA,KAAK,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,CAACsB,UAAU,CAAE,EAAC,CAAC;;IAE7E;IACA,IAAIA,UAAU,CAACxB,MAAM,GAAG,CAAC,EAAE;MACzB,OAAO,CAAC,CAAC;IACX;;IAEA;IACA,IAAIkB,OAAO,CAAClB,MAAM,GAAG,CAAC,EAAE;MACtB,OAAO,CAAC;IACV;;IAEA;IACA,OAAO,CAAC;EAEV;AACF,CAAC,CAAC;AAAA"}
@@ -38,32 +38,38 @@ var _default = ({
38
38
  nameTreshold = 10
39
39
  } = {}) => ({
40
40
  name: 'Authors',
41
- extract: record => record.get(/^(?<def>100|700)$/u).map(({
42
- subfields
41
+ extract: ({
42
+ record
43
43
  }) => {
44
- return subfields.filter(({
45
- code,
46
- value
47
- }) => code && value).filter(({
48
- code
49
- }) => ['a', '0'].includes(code)).map(toObj).reduce((acc, v) => ({
50
- ...acc,
51
- ...v
52
- }), {});
53
- function toObj({
54
- code,
55
- value
56
- }) {
57
- if (code === 'a') {
44
+ //const label = recordExternal && recordExternal.label ? recordExternal.label : 'record';
45
+ const authors = record.get(/^(?<def>100|700)$/u).map(({
46
+ subfields
47
+ }) => {
48
+ return subfields.filter(({
49
+ code,
50
+ value
51
+ }) => code && value).filter(({
52
+ code
53
+ }) => ['a', '0'].includes(code)).map(toObj).reduce((acc, v) => ({
54
+ ...acc,
55
+ ...v
56
+ }), {});
57
+ function toObj({
58
+ code,
59
+ value
60
+ }) {
61
+ if (code === 'a') {
62
+ return {
63
+ name: (0, _matchingUtils.testStringOrNumber)(value) ? String(value).replace(/[^\p{Letter}\p{Number}]/gu, '').toLowerCase() : ''
64
+ };
65
+ }
58
66
  return {
59
- name: (0, _matchingUtils.testStringOrNumber)(value) ? String(value).replace(/[^\p{Letter}\p{Number}]/gu, '').toLowerCase() : ''
67
+ id: value
60
68
  };
61
69
  }
62
- return {
63
- id: value
64
- };
65
- }
66
- }),
70
+ });
71
+ return authors;
72
+ },
67
73
  compare: (a, b) => {
68
74
  const maxAuthors = a.length > b.length ? a.length : b.length;
69
75
  const matchingIds = findMatchingIds();
@@ -1 +1 @@
1
- {"version":3,"file":"authors.js","names":["nameTreshold","name","extract","record","get","map","subfields","filter","code","value","includes","toObj","reduce","acc","v","testStringOrNumber","String","replace","toLowerCase","id","compare","a","b","maxAuthors","length","matchingIds","findMatchingIds","matchingNames","findMatchingNames","idPoints","namePoints","totalPoints","findMatches","distance","leven","maxLength","getMaxLength","percentage","key","cb","valuesA","o","valuesB","allValues","concat","occurrance","otherValue"],"sources":["../../../../src/match-detection/features/bib/authors.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\nimport {LevenshteinDistance as leven} from 'natural';\nimport {testStringOrNumber} from '../../../matching-utils';\n\n// We should extract also organisational authors (110/710)\n\nexport default ({nameTreshold = 10} = {}) => ({\n name: 'Authors',\n extract: record => record.get(/^(?<def>100|700)$/u)\n .map(({subfields}) => {\n return subfields\n .filter(({code, value}) => code && value)\n .filter(({code}) => ['a', '0'].includes(code))\n .map(toObj)\n .reduce((acc, v) => ({...acc, ...v}), {});\n\n function toObj({code, value}) {\n if (code === 'a') {\n return {name: testStringOrNumber(value) ? String(value).replace(/[^\\p{Letter}\\p{Number}]/gu, '').toLowerCase() : ''};\n }\n\n return {id: value};\n }\n }),\n compare: (a, b) => {\n const maxAuthors = a.length > b.length ? a.length : b.length;\n const matchingIds = findMatchingIds();\n\n if (maxAuthors >= 3 && matchingIds >= 3) {\n return 0.3;\n }\n\n const matchingNames = findMatchingNames();\n const idPoints = matchingIds / maxAuthors * 0.3;\n const namePoints = matchingNames / maxAuthors * 0.2;\n const totalPoints = idPoints + namePoints;\n\n return totalPoints <= 0.2 ? totalPoints : 0.2;\n\n function findMatchingIds() {\n return findMatches('id', (a, b) => a === b);\n }\n\n function findMatchingNames() {\n return findMatches('name', (a, b) => {\n const distance = leven(a, b);\n\n if (distance === 0) {\n return true;\n }\n\n const maxLength = getMaxLength();\n const percentage = distance / maxLength * 100;\n\n return percentage <= nameTreshold;\n\n function getMaxLength() {\n return a.length > b.length ? a.length : b.length;\n }\n });\n }\n\n function findMatches(key, cb) {\n const valuesA = a.filter(o => o[key]).map(o => o[key]);\n const valuesB = b.filter(o => o[key]).map(o => o[key]);\n const allValues = valuesA.concat(valuesB);\n\n return allValues.reduce((acc, value) => {\n const occurrance = allValues.filter(otherValue => cb(value, otherValue)).length;\n return occurrance >= 2 ? acc + 1 : acc;\n }, 0);\n }\n }\n});\n"],"mappings":";;;;;;AA4BA;AACA;AA7BA;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;AAAA,eAEe,CAAC;EAACA,YAAY,GAAG;AAAE,CAAC,GAAG,CAAC,CAAC,MAAM;EAC5CC,IAAI,EAAE,SAAS;EACfC,OAAO,EAAEC,MAAM,IAAIA,MAAM,CAACC,GAAG,CAAC,oBAAoB,CAAC,CAChDC,GAAG,CAAC,CAAC;IAACC;EAAS,CAAC,KAAK;IACpB,OAAOA,SAAS,CACbC,MAAM,CAAC,CAAC;MAACC,IAAI;MAAEC;IAAK,CAAC,KAAKD,IAAI,IAAIC,KAAK,CAAC,CACxCF,M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QAC/E,OAAOqB,UAAU,IAAI,CAAC,GAAGhC,GAAG,GAAG,CAAC,GAAGA,GAAG;MACxC,CAAC,EAAE,CAAC,CAAC;IACP;EACF;AACF,CAAC,CAAC;AAAA"}
1
+ {"version":3,"file":"authors.js","names":["nameTreshold","name","extract","record","authors","get","map","subfields","filter","code","value","includes","toObj","reduce","acc","v","testStringOrNumber","String","replace","toLowerCase","id","compare","a","b","maxAuthors","length","matchingIds","findMatchingIds","matchingNames","findMatchingNames","idPoints","namePoints","totalPoints","findMatches","distance","leven","maxLength","getMaxLength","percentage","key","cb","valuesA","o","valuesB","allValues","concat","occurrance","otherValue"],"sources":["../../../../src/match-detection/features/bib/authors.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\nimport {LevenshteinDistance as leven} from 'natural';\nimport {testStringOrNumber} from '../../../matching-utils';\n\n// We should extract also organisational authors (110/710)\n\nexport default ({nameTreshold = 10} = {}) => ({\n name: 'Authors',\n extract: ({record}) => {\n //const label = recordExternal && recordExternal.label ? recordExternal.label : 'record';\n const authors = record.get(/^(?<def>100|700)$/u)\n .map(({subfields}) => {\n return subfields\n .filter(({code, value}) => code && value)\n .filter(({code}) => ['a', '0'].includes(code))\n .map(toObj)\n .reduce((acc, v) => ({...acc, ...v}), {});\n\n function toObj({code, value}) {\n if (code === 'a') {\n return {name: testStringOrNumber(value) ? String(value).replace(/[^\\p{Letter}\\p{Number}]/gu, '').toLowerCase() : ''};\n }\n\n return {id: value};\n }\n });\n return authors;\n },\n compare: (a, b) => {\n const maxAuthors = a.length > b.length ? a.length : b.length;\n const matchingIds = findMatchingIds();\n\n if (maxAuthors >= 3 && matchingIds >= 3) {\n return 0.3;\n }\n\n const matchingNames = findMatchingNames();\n const idPoints = matchingIds / maxAuthors * 0.3;\n const namePoints = matchingNames / maxAuthors * 0.2;\n const totalPoints = idPoints + namePoints;\n\n return totalPoints <= 0.2 ? totalPoints : 0.2;\n\n function findMatchingIds() {\n return findMatches('id', (a, b) => a === b);\n }\n\n function findMatchingNames() {\n return findMatches('name', (a, b) => {\n const distance = leven(a, b);\n\n if (distance === 0) {\n return true;\n }\n\n const maxLength = getMaxLength();\n const percentage = distance / maxLength * 100;\n\n return percentage <= nameTreshold;\n\n function getMaxLength() {\n return a.length > b.length ? a.length : b.length;\n }\n });\n }\n\n function findMatches(key, cb) {\n const valuesA = a.filter(o => o[key]).map(o => o[key]);\n const valuesB = b.filter(o => o[key]).map(o => o[key]);\n const allValues = valuesA.concat(valuesB);\n\n return allValues.reduce((acc, value) => {\n const occurrance = allValues.filter(otherValue => cb(value, otherValue)).length;\n return occurrance >= 2 ? acc + 1 : acc;\n }, 0);\n }\n }\n});\n"],"mappings":";;;;;;AA4BA;AACA;AA7BA;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;AAAA,eAEe,CAAC;EAACA,YAAY,GAAG;AAAE,CAAC,GAAG,CAAC,CAAC,MAAM;EAC5CC,IAAI,EAAE,SAAS;EACfC,OAAO,EAAE,CAAC;IAACC;EAAM,CAAC,KAAK;IACrB;IACA,MAAMC,OA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,GAAGH,OAAO,CAACI,MAAM,CAACF,OAAO,CAAC;MAEzC,OAAOC,SAAS,CAAC/B,MAAM,CAAC,CAACC,GAAG,EAAEJ,KAAK,KAAK;QACtC,MAAMoC,UAAU,GAAGF,SAAS,CAACpC,MAAM,CAACuC,UAAU,IAAIP,EAAE,CAAC9B,KAAK,EAAEqC,UAAU,CAAC,CAAC,CAACtB,MAAM;QAC/E,OAAOqB,UAAU,IAAI,CAAC,GAAGhC,GAAG,GAAG,CAAC,GAAGA,GAAG;MACxC,CAAC,EAAE,CAAC,CAAC;IACP;EACF;AACF,CAAC,CAAC;AAAA"}
@@ -30,9 +30,12 @@ exports.default = void 0;
30
30
  * @licend The above is the entire license notice
31
31
  * for the JavaScript code in this file.
32
32
  *
33
- */var _default = () => ({
33
+ */
34
+ var _default = () => ({
34
35
  name: 'Bibliographic level',
35
- extract: r => r.leader[7] ? [r.leader[7]] : [],
36
+ extract: ({
37
+ record
38
+ }) => record.leader[7] ? [record.leader[7]] : [],
36
39
  compare: (a, b) => a[0] === b[0] ? 0.1 : -0.2
37
40
  });
38
41
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"file":"bibliographic-level.js","names":["name","extract","r","leader","compare","a","b"],"sources":["../../../../src/match-detection/features/bib/bibliographic-level.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\nexport default () => ({\n name: 'Bibliographic level',\n extract: r => r.leader[7] ? [r.leader[7]] : [],\n compare: (a, b) => a[0] === b[0] ? 0.1 : -0.2\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,EA1BA,eA4Be,OAAO;EACpBA,IAAI,EAAE,qBAAqB;EAC3BC,OAAO,EAAEC,CAAC,IAAIA,CAAC,CAACC,MAAM,CAAC,CAAC,CAAC,GAAG,CAACD,CAAC,CAACC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE;EAC9CC,OAAO,EAAE,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAAC,CAAC,CAAC,KAAKC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC;AAC5C,CAAC,CAAC;AAAA"}
1
+ {"version":3,"file":"bibliographic-level.js","names":["name","extract","record","leader","compare","a","b"],"sources":["../../../../src/match-detection/features/bib/bibliographic-level.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\nexport default () => ({\n name: 'Bibliographic level',\n extract: ({record}) => record.leader[7] ? [record.leader[7]] : [],\n compare: (a, b) => a[0] === b[0] ? 0.1 : -0.2\n});\n"],"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;AA1BA,eA4Be,OAAO;EACpBA,IAAI,EAAE,qBAAqB;EAC3BC,OAAO,EAAE,CAAC;IAACC;EAAM,CAAC,KAAKA,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,GAAG,CAACD,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE;EACjEC,OAAO,EAAE,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAAC,CAAC,CAAC,KAAKC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC;AAC5C,CAAC,CAAC;AAAA"}
@@ -30,9 +30,12 @@ exports.default = void 0;
30
30
  * @licend The above is the entire license notice
31
31
  * for the JavaScript code in this file.
32
32
  *
33
- */var _default = () => ({
33
+ */
34
+ var _default = () => ({
34
35
  name: 'Host/Component record',
35
- extract: r => r.get(/^773$/u).length > 0 ? ['component'] : ['host'],
36
+ extract: ({
37
+ record
38
+ }) => record.get(/^773$/u).length > 0 ? ['component'] : ['host'],
36
39
  compare: (a, b) => a[0] === b[0] ? 0.0 : -1.0
37
40
  });
38
41
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"file":"host-component.js","names":["name","extract","r","get","length","compare","a","b"],"sources":["../../../../src/match-detection/features/bib/host-component.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\nexport default () => ({\n name: 'Host/Component record',\n extract: r => r.get(/^773$/u).length > 0 ? ['component'] : ['host'],\n compare: (a, b) => a[0] === b[0] ? 0.0 : -1.0\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,EA1BA,eA4Be,OAAO;EACpBA,IAAI,EAAE,uBAAuB;EAC7BC,OAAO,EAAEC,CAAC,IAAIA,CAAC,CAACC,GAAG,CAAC,QAAQ,CAAC,CAACC,MAAM,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC;EACnEC,OAAO,EAAE,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAAC,CAAC,CAAC,KAAKC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC;AAC5C,CAAC,CAAC;AAAA"}
1
+ {"version":3,"file":"host-component.js","names":["name","extract","record","get","length","compare","a","b"],"sources":["../../../../src/match-detection/features/bib/host-component.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\nexport default () => ({\n name: 'Host/Component record',\n extract: ({record}) => record.get(/^773$/u).length > 0 ? ['component'] : ['host'],\n compare: (a, b) => a[0] === b[0] ? 0.0 : -1.0\n});\n"],"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;AA1BA,eA4Be,OAAO;EACpBA,IAAI,EAAE,uBAAuB;EAC7BC,OAAO,EAAE,CAAC;IAACC;EAAM,CAAC,KAAKA,MAAM,CAACC,GAAG,CAAC,QAAQ,CAAC,CAACC,MAAM,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC;EACjFC,OAAO,EAAE,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAAC,CAAC,CAAC,KAAKC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC;AAC5C,CAAC,CAAC;AAAA"}
@@ -43,7 +43,6 @@ describe('match-detection/features/bib/', () => {
43
43
  fixura: {
44
44
  reader: _fixura.READERS.JSON
45
45
  },
46
- // eslint-disable-next-line max-statements
47
46
  callback: ({
48
47
  enabled = true,
49
48
  feature,
@@ -65,7 +64,9 @@ describe('match-detection/features/bib/', () => {
65
64
  const {
66
65
  extract
67
66
  } = features[feature](options);
68
- (0, _chai.expect)(extract(record)).to.eql(expectedFeatures);
67
+ (0, _chai.expect)(extract({
68
+ record
69
+ })).to.eql(expectedFeatures);
69
70
  return;
70
71
  }
71
72
  if (type === 'compare') {
@@ -1 +1 @@
1
- {"version":3,"file":"index.spec.js","names":["describe","generateTests","path","__dirname","useMetadataFile","fixura","reader","READERS","JSON","callback","enabled","feature","options","type","expectations","expectedFeatures","inputRecord","record","MarcRecord","subfieldValues","extract","features","expect","to","eql","featuresA","featuresB","expectedPoints","compare","equal","Error"],"sources":["../../../../src/match-detection/features/bib/index.spec.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 generateTests from '@natlibfi/fixugen';\nimport {READERS} from '@natlibfi/fixura';\nimport {expect} from 'chai';\nimport {MarcRecord} from '@natlibfi/marc-record';\nimport * as features from '.';\n\n\ndescribe('match-detection/features/bib/', () => {\n generateTests({\n path: [__dirname, '..', '..', '..', '..', 'test-fixtures', 'match-detection', 'features', 'bib'],\n useMetadataFile: true,\n fixura: {\n reader: READERS.JSON\n },\n // eslint-disable-next-line max-statements\n callback: ({enabled = true, feature, options, type, ...expectations}) => {\n\n if (!enabled) {\n return;\n }\n\n if (type === 'extract') {\n const {expectedFeatures, inputRecord} = expectations;\n const record = new MarcRecord(inputRecord, {subfieldValues: false});\n const {extract} = features[feature](options);\n\n expect(extract(record)).to.eql(expectedFeatures);\n return;\n }\n\n if (type === 'compare') {\n const {featuresA, featuresB, expectedPoints} = expectations;\n const {compare} = features[feature](options);\n\n expect(compare(featuresA, featuresB)).to.equal(expectedPoints);\n return;\n }\n\n throw new Error(`Invalid type ${type}`);\n }\n });\n});\n"],"mappings":";;AA4BA;AACA;AACA;AACA;AACA;AAA8B;AAAA;AAAA;AAhC9B;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;;AASAA,QAAQ,CAAC,+BAA+B,EAAE,MAAM;EAC9C,IAAAC,gBAAa,EAAC;IACZC,IAAI,EAAE,CAACC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,eAAe,EAAE,iBAAiB,EAAE,UAAU,EAAE,KAAK,CAAC;IAChGC,eAAe,EAAE,IAAI;IACrBC,MAAM,EAAE;MACNC,MAAM,EAAEC,eAAO,CAACC;IAClB,CAAC;IACD;IACAC,QAAQ,EAAE,CAAC;MAACC,OAAO,GAAG,IAAI;MAAEC,OAAO;MAAEC,OAAO;MAAEC,IAAI;MAAE,GAAGC;IAAY,CAAC,KAAK;MAEvE,IAAI,CAACJ,OAAO,EAAE;QACZ;MACF;MAEA,IAAIG,IAAI,KAAK,SAAS,EAAE;QACtB,MAAM;UAACE,gBAAgB;UAAEC;QAAW,CAAC,GAAGF,YAAY;QACpD,MAAMG,MAAM,GAAG,IAAIC,sBAAU,CAACF,WAAW,EAAE;UAACG,cAAc,EAAE;QAAK,CAAC,CAAC;QACnE,MAAM;UAACC;QAAO,CAAC,GAAGC,QAAQ,CAACV,OAAO,CAAC,CAACC,OAAO,CAAC;QAE5C,IAAAU,YAAM,EAACF,OAAO,CAACH,MAAM,CAAC,CAAC,CAACM,EAAE,CAACC,GAAG,CAACT,gBAAgB,CAAC;QAChD;MACF;MAEA,IAAIF,IAAI,KAAK,SAAS,EAAE;QACtB,MAAM;UAACY,SAAS;UAAEC,SAAS;UAAEC;QAAc,CAAC,GAAGb,YAAY;QAC3D,MAAM;UAACc;QAAO,CAAC,GAAGP,QAAQ,CAACV,OAAO,CAAC,CAACC,OAAO,CAAC;QAE5C,IAAAU,YAAM,EAACM,OAAO,CAACH,SAAS,EAAEC,SAAS,CAAC,CAAC,CAACH,EAAE,CAACM,KAAK,CAACF,cAAc,CAAC;QAC9D;MACF;MAEA,MAAM,IAAIG,KAAK,CAAE,gBAAejB,IAAK,EAAC,CAAC;IACzC;EACF,CAAC,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"file":"index.spec.js","names":["describe","generateTests","path","__dirname","useMetadataFile","fixura","reader","READERS","JSON","callback","enabled","feature","options","type","expectations","expectedFeatures","inputRecord","record","MarcRecord","subfieldValues","extract","features","expect","to","eql","featuresA","featuresB","expectedPoints","compare","equal","Error"],"sources":["../../../../src/match-detection/features/bib/index.spec.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 generateTests from '@natlibfi/fixugen';\nimport {READERS} from '@natlibfi/fixura';\nimport {expect} from 'chai';\nimport {MarcRecord} from '@natlibfi/marc-record';\nimport * as features from '.';\n\n\ndescribe('match-detection/features/bib/', () => {\n generateTests({\n path: [__dirname, '..', '..', '..', '..', 'test-fixtures', 'match-detection', 'features', 'bib'],\n useMetadataFile: true,\n fixura: {\n reader: READERS.JSON\n },\n\n callback: ({enabled = true, feature, options, type, ...expectations}) => {\n\n if (!enabled) {\n return;\n }\n\n if (type === 'extract') {\n const {expectedFeatures, inputRecord} = expectations;\n const record = new MarcRecord(inputRecord, {subfieldValues: false});\n const {extract} = features[feature](options);\n\n expect(extract({record})).to.eql(expectedFeatures);\n return;\n }\n\n if (type === 'compare') {\n const {featuresA, featuresB, expectedPoints} = expectations;\n const {compare} = features[feature](options);\n\n expect(compare(featuresA, featuresB)).to.equal(expectedPoints);\n return;\n }\n\n throw new Error(`Invalid type ${type}`);\n }\n });\n});\n"],"mappings":";;AA4BA;AACA;AACA;AACA;AACA;AAA8B;AAAA;AAAA;AAhC9B;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;;AASAA,QAAQ,CAAC,+BAA+B,EAAE,MAAM;EAC9C,IAAAC,gBAAa,EAAC;IACZC,IAAI,EAAE,CAACC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,eAAe,EAAE,iBAAiB,EAAE,UAAU,EAAE,KAAK,CAAC;IAChGC,eAAe,EAAE,IAAI;IACrBC,MAAM,EAAE;MACNC,MAAM,EAAEC,eAAO,CAACC;IAClB,CAAC;IAEDC,QAAQ,EAAE,CAAC;MAACC,OAAO,GAAG,IAAI;MAAEC,OAAO;MAAEC,OAAO;MAAEC,IAAI;MAAE,GAAGC;IAAY,CAAC,KAAK;MAEvE,IAAI,CAACJ,OAAO,EAAE;QACZ;MACF;MAEA,IAAIG,IAAI,KAAK,SAAS,EAAE;QACtB,MAAM;UAACE,gBAAgB;UAAEC;QAAW,CAAC,GAAGF,YAAY;QACpD,MAAMG,MAAM,GAAG,IAAIC,sBAAU,CAACF,WAAW,EAAE;UAACG,cAAc,EAAE;QAAK,CAAC,CAAC;QACnE,MAAM;UAACC;QAAO,CAAC,GAAGC,QAAQ,CAACV,OAAO,CAAC,CAACC,OAAO,CAAC;QAE5C,IAAAU,YAAM,EAACF,OAAO,CAAC;UAACH;QAAM,CAAC,CAAC,CAAC,CAACM,EAAE,CAACC,GAAG,CAACT,gBAAgB,CAAC;QAClD;MACF;MAEA,IAAIF,IAAI,KAAK,SAAS,EAAE;QACtB,MAAM;UAACY,SAAS;UAAEC,SAAS;UAAEC;QAAc,CAAC,GAAGb,YAAY;QAC3D,MAAM;UAACc;QAAO,CAAC,GAAGP,QAAQ,CAACV,OAAO,CAAC,CAACC,OAAO,CAAC;QAE5C,IAAAU,YAAM,EAACM,OAAO,CAACH,SAAS,EAAEC,SAAS,CAAC,CAAC,CAACH,EAAE,CAACM,KAAK,CAACF,cAAc,CAAC;QAC9D;MACF;MAEA,MAAM,IAAIG,KAAK,CAAE,gBAAejB,IAAK,EAAC,CAAC;IACzC;EACF,CAAC,CAAC;AACJ,CAAC,CAAC"}
@@ -32,7 +32,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
32
32
  * @licend The above is the entire license notice
33
33
  * for the JavaScript code in this file.
34
34
  *
35
- */var _default = () => {
35
+ */
36
+ var _default = () => {
36
37
  const {
37
38
  extract,
38
39
  compare
@@ -1 +1 @@
1
- {"version":3,"file":"isbn.js","names":["extract","compare","createInterface","pattern","subfieldCodes","name"],"sources":["../../../../src/match-detection/features/bib/isbn.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 createInterface from './standard-identifier-factory';\n\nexport default () => {\n const {extract, compare} = createInterface({pattern: /^020$/u, subfieldCodes: ['a', 'z']});\n return {extract, compare, name: 'ISBN'};\n};\n"],"mappings":";;;;;;AA4BA;AAA4D;AA5B5D;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,EA1BA,eA8Be,MAAM;EACnB,MAAM;IAACA,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;EAAM,CAAC;AACzC,CAAC;AAAA"}
1
+ {"version":3,"file":"isbn.js","names":["extract","compare","createInterface","pattern","subfieldCodes","name"],"sources":["../../../../src/match-detection/features/bib/isbn.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 createInterface from './standard-identifier-factory';\n\nexport default () => {\n const {extract, compare} = createInterface({pattern: /^020$/u, subfieldCodes: ['a', 'z']});\n return {extract, compare, name: 'ISBN'};\n};\n"],"mappings":";;;;;;AA4BA;AAA4D;AA5B5D;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;AA1BA,eA8Be,MAAM;EACnB,MAAM;IAACA,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;EAAM,CAAC;AACzC,CAAC;AAAA"}
@@ -32,7 +32,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
32
32
  * @licend The above is the entire license notice
33
33
  * for the JavaScript code in this file.
34
34
  *
35
- */var _default = () => {
35
+ */
36
+ var _default = () => {
36
37
  const {
37
38
  extract,
38
39
  compare
@@ -1 +1 @@
1
- {"version":3,"file":"issn.js","names":["extract","compare","createInterface","pattern","subfieldCodes","name"],"sources":["../../../../src/match-detection/features/bib/issn.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 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":";;;;;;AA4BA;AAA4D;AA5B5D;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,EA1BA,eA8Be,MAAM;EACnB,MAAM;IAACA,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;AAAA"}
1
+ {"version":3,"file":"issn.js","names":["extract","compare","createInterface","pattern","subfieldCodes","name"],"sources":["../../../../src/match-detection/features/bib/issn.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 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":";;;;;;AA4BA;AAA4D;AA5B5D;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;AA1BA,eA8Be,MAAM;EACnB,MAAM;IAACA,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;AAAA"}
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _debug = _interopRequireDefault(require("debug"));
8
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
- /* eslint-disable max-statements */
10
9
  /**
11
10
  *
12
11
  * @licstart The following is the entire license notice for the JavaScript code in this file.
@@ -39,34 +38,39 @@ const debug = (0, _debug.default)('@natlibfi/melinda-record-matching:match-detec
39
38
  const debugData = debug.extend('data');
40
39
  var _default = () => ({
41
40
  name: 'Language',
42
- extract: record => {
41
+ extract: ({
42
+ record,
43
+ recordExternal
44
+ }) => {
45
+ const label = recordExternal && recordExternal.label ? recordExternal.label : 'record';
43
46
  const value008 = get008Value();
44
47
  const values041 = get041Values();
45
- debugData(`008: ${JSON.stringify(value008)}, 041: ${JSON.stringify(values041)}`);
48
+ debugData(`${label} 008: ${JSON.stringify(value008)}, 041: ${JSON.stringify(values041)}`);
46
49
  if (value008 && values041.length > 0) {
47
- debugData(`There's both 008 and 041, searching for value in both`);
50
+ debugData(`${label} There's both 008 and 041, searching for value in both`);
48
51
  const correspondingValue = values041.find(v => v === value008);
49
- debugData(`Corresponding value: ${correspondingValue}`);
52
+ debugData(`${label} Corresponding value: ${correspondingValue}`);
50
53
  return correspondingValue ? [correspondingValue] : [];
51
54
  }
52
55
  if (!value008 && values041.length < 1) {
53
- debugData(`No actual values found`);
56
+ debugData(`{$label} No actual values found`);
54
57
  return [];
55
58
  }
56
59
  return value008 ? [value008] : [values041[0]];
57
60
  function get008Value() {
58
61
  var _record$get, _record$get$;
59
62
  const value = ((_record$get = record.get(/^008$/u)) === null || _record$get === void 0 ? void 0 : (_record$get$ = _record$get[0]) === null || _record$get$ === void 0 ? void 0 : _record$get$.value) || undefined;
60
- debugData(`008 value: ${value}`);
63
+ debugData(`${label} 008 value: ${value}`);
61
64
  if (!value) {
62
65
  return undefined;
63
66
  }
64
67
  const code = value.slice(35, 38);
65
- debugData(`008 code: ${code}`);
68
+ debugData(`${label} 008 code: ${code}`);
66
69
  return code === '|||' || code === ' ' || code === '^^^' ? undefined : code;
67
70
  }
68
71
 
69
72
  // Main language for the resource: in the first f041 $a or f041 $d
73
+ // Should we get all $a or $d languages instead of just the first?
70
74
  // Uses only f041s that have 2nd ind ' ', which means that the codes used are MARC 21 language codes
71
75
 
72
76
  function get041Values() {
@@ -1 +1 @@
1
- {"version":3,"file":"language.js","names":["debug","createDebugLogger","debugData","extend","name","extract","record","value008","get008Value","values041","get041Values","JSON","stringify","length","correspondingValue","find","v","value","get","undefined","code","slice","filter","ind2","map","subfields","flat","compare","a","b"],"sources":["../../../../src/match-detection/features/bib/language.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';\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 => {\n const value008 = get008Value();\n const values041 = get041Values();\n debugData(`008: ${JSON.stringify(value008)}, 041: ${JSON.stringify(values041)}`);\n\n if (value008 && values041.length > 0) {\n debugData(`There's both 008 and 041, searching for value in both`);\n const correspondingValue = values041.find(v => v === value008);\n debugData(`Corresponding value: ${correspondingValue}`);\n return correspondingValue ? [correspondingValue] : [];\n }\n\n if (!value008 && values041.length < 1) {\n debugData(`No actual values found`);\n return [];\n }\n\n return value008 ? [value008] : [values041[0]];\n\n function get008Value() {\n const value = record.get(/^008$/u)?.[0]?.value || undefined;\n debugData(`008 value: ${value}`);\n\n if (!value) {\n return undefined;\n }\n\n const code = value.slice(35, 38);\n debugData(`008 code: ${code}`);\n return code === '|||' || code === ' ' || code === '^^^' ? undefined : code;\n }\n\n // Main language for the resource: in the first f041 $a or f041 $d\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 .map(({value}) => value);\n }\n },\n compare: (a, b) => {\n debugData(`Comparing ${JSON.stringify(a[0])} and ${JSON.stringify(b[0])}`);\n\n if (a.length === 0 || b.length === 0) {\n debugData(`No language to compare`);\n return 0;\n }\n\n debugData(`There are languages to compare`);\n\n if (a[0] === b[0]) {\n return 0.1;\n }\n\n return a[0] === 'und' || b[0] === 'und' ? 0.0 : -1.0;\n }\n});\n"],"mappings":";;;;;;AA6BA;AAAsC;AA7BtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,MAAMA,KAAK,GAAG,IAAAC,cAAiB,EAAC,qEAAqE,CAAC;AACtG,MAAMC,SAAS,GAAGF,KAAK,CAACG,MAAM,CAAC,MAAM,CAAC;AAAC,eAExB,OAAO;EACpBC,IAAI,EAAE,UAAU;EAChBC,OAAO,EAAEC,MAAM,IAAI;IACjB,MAAMC,QAAQ,GAAGC,WAAW,EAAE;IAC9B,MAAMC,SAAS,GAAGC,YAAY,EAAE;IAChCR,SAAS,CAAE,QAAOS,IAAI,CAACC,SAAS,CAACL,QAAQ,CAAE,UAASI,IAAI,CAACC,SAAS,CAACH,SAAS,CAAE,EAAC,CAAC;IAEhF,IAAIF,QAAQ,IAAIE,SAAS,CAACI,MAAM,GAAG,CAAC,EAAE;MACpCX,SAAS,CAAE,uDAAsD,CAAC;MAClE,MAAMY,kBAAkB,GAAGL,SAAS,CAACM,IAAI,CAACC,CAAC,IAAIA,CAAC,KAAKT,QAAQ,CAAC;MAC9DL,SAAS,CAAE,wBAAuBY,kBAAmB,EAAC,CAAC;MACvD,OAAOA,kBAAkB,GAAG,CAACA,kBAAk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S,CAAE,aAAYS,IAAI,CAACC,SAAS,CAACgB,CAAC,CAAC,CAAC,CAAC,CAAE,QAAOjB,IAAI,CAACC,SAAS,CAACiB,CAAC,CAAC,CAAC,CAAC,CAAE,EAAC,CAAC;IAE1E,IAAID,CAAC,CAACf,MAAM,KAAK,CAAC,IAAIgB,CAAC,CAAChB,MAAM,KAAK,CAAC,EAAE;MACpCX,SAAS,CAAE,wBAAuB,CAAC;MACnC,OAAO,CAAC;IACV;IAEAA,SAAS,CAAE,gCAA+B,CAAC;IAE3C,IAAI0B,CAAC,CAAC,CAAC,CAAC,KAAKC,CAAC,CAAC,CAAC,CAAC,EAAE;MACjB,OAAO,GAAG;IACZ;IAEA,OAAOD,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,IAAIC,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,GAAG,GAAG,GAAG,CAAC,GAAG;EACtD;AACF,CAAC,CAAC;AAAA"}
1
+ {"version":3,"file":"language.js","names":["debug","createDebugLogger","debugData","extend","name","extract","record","recordExternal","label","value008","get008Value","values041","get041Values","JSON","stringify","length","correspondingValue","find","v","value","get","undefined","code","slice","filter","ind2","map","subfields","flat","compare","a","b"],"sources":["../../../../src/match-detection/features/bib/language.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\nimport createDebugLogger from 'debug';\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 > 0) {\n debugData(`${label} There's both 008 and 041, searching for value in both`);\n const correspondingValue = values041.find(v => v === value008);\n debugData(`${label} Corresponding value: ${correspondingValue}`);\n return correspondingValue ? [correspondingValue] : [];\n }\n\n if (!value008 && values041.length < 1) {\n debugData(`{$label} No actual values found`);\n return [];\n }\n\n return value008 ? [value008] : [values041[0]];\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 code === '|||' || code === ' ' || code === '^^^' ? undefined : code;\n }\n\n // Main language for the resource: in the first f041 $a or f041 $d\n // Should we get all $a or $d languages instead of just the first?\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 .map(({value}) => value);\n }\n },\n compare: (a, b) => {\n debugData(`Comparing ${JSON.stringify(a[0])} and ${JSON.stringify(b[0])}`);\n\n if (a.length === 0 || b.length === 0) {\n debugData(`No language to compare`);\n return 0;\n }\n\n debugData(`There are languages to compare`);\n\n if (a[0] === b[0]) {\n return 0.1;\n }\n\n return a[0] === 'und' || b[0] === 'und' ? 0.0 : -1.0;\n }\n});\n"],"mappings":";;;;;;AA4BA;AAAsC;AA5BtC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,EAAE;MACpCb,SAAS,CAAE,wBAAuB,CAAC;MACnC,OAAO,CAAC;IACV;IAEAA,SAAS,CAAE,gCAA+B,CAAC;IAE3C,IAAI4B,CAAC,CAAC,CAAC,CAAC,KAAKC,CAAC,CAAC,CAAC,CAAC,EAAE;MACjB,OAAO,GAAG;IACZ;IAEA,OAAOD,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,IAAIC,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,GAAG,GAAG,GAAG,CAAC,GAAG;EACtD;AACF,CAAC,CAAC;AAAA"}
@@ -32,7 +32,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
32
32
  * @licend The above is the entire license notice
33
33
  * for the JavaScript code in this file.
34
34
  *
35
- */var _default = () => {
35
+ */
36
+ var _default = () => {
36
37
  const {
37
38
  extract,
38
39
  compare
@@ -1 +1 @@
1
- {"version":3,"file":"melinda-id.js","names":["extract","compare","createInterface","name"],"sources":["../../../../src/match-detection/features/bib/melinda-id.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 createInterface from './melinda-identifier-factory';\n\nexport default () => {\n const {extract, compare} = createInterface();\n return {extract, compare, name: 'melinda-id'};\n};\n"],"mappings":";;;;;;AA4BA;AAA2D;AA5B3D;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,EA1BA,eA8Be,MAAM;EACnB,MAAM;IAACA,OAAO;IAAEC;EAAO,CAAC,GAAG,IAAAC,iCAAe,GAAE;EAC5C,OAAO;IAACF,OAAO;IAAEC,OAAO;IAAEE,IAAI,EAAE;EAAY,CAAC;AAC/C,CAAC;AAAA"}
1
+ {"version":3,"file":"melinda-id.js","names":["extract","compare","createInterface","name"],"sources":["../../../../src/match-detection/features/bib/melinda-id.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 createInterface from './melinda-identifier-factory';\n\nexport default () => {\n const {extract, compare} = createInterface();\n return {extract, compare, name: 'melinda-id'};\n};\n"],"mappings":";;;;;;AA4BA;AAA2D;AA5B3D;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;AA1BA,eA8Be,MAAM;EACnB,MAAM;IAACA,OAAO;IAAEC;EAAO,CAAC,GAAG,IAAAC,iCAAe,GAAE;EAC5C,OAAO;IAACF,OAAO;IAAEC,OAAO;IAAEE,IAAI,EAAE;EAAY,CAAC;AAC/C,CAAC;AAAA"}
@@ -47,12 +47,15 @@ var _default = () => {
47
47
  extract,
48
48
  compare
49
49
  };
50
- function extract(record) {
50
+ function extract({
51
+ record,
52
+ recordExternal
53
+ }) {
51
54
  const isMelindaRecord = record.get('003').some(f003 => f003.value === 'FI-MELINDA');
52
55
  const [f001] = record.get('001').map(field => field.value);
53
56
  const f035MelindaIds = (0, _matchingUtils.getMelindaIdsF035)(record);
54
57
  if (isMelindaRecord === undefined && f001 === undefined && f035MelindaIds.length < 1) {
55
- debug(`No Melinda-IDs found`);
58
+ debug(`${recordExternal.label} No Melinda-IDs found`);
56
59
  return {};
57
60
  }
58
61
  return {
@@ -61,8 +64,6 @@ var _default = () => {
61
64
  f035MelindaIds
62
65
  };
63
66
  }
64
-
65
- // eslint-disable-next-line max-statements
66
67
  function compare(a, b) {
67
68
  if (a.isMelindaRecord && b.isMelindaRecord && a.f001 === b.f001) {
68
69
  debugData(`Melinda record's A f001 ${a.f001} matches Melinda record's B f001 ${a.f001}`);
@@ -1 +1 @@
1
- {"version":3,"file":"melinda-identifier-factory.js","names":["debug","createDebugLogger","debugData","extend","extract","compare","record","isMelindaRecord","get","some","f003","value","f001","map","field","f035MelindaIds","getMelindaIdsF035","undefined","length","a","b","id","JSON","stringify","idA","idB"],"sources":["../../../../src/match-detection/features/bib/melinda-identifier-factory.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 {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) {\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(`No Melinda-IDs found`);\n return {};\n }\n\n return {isMelindaRecord, f001, f035MelindaIds};\n\n }\n\n // eslint-disable-next-line max-statements\n function compare(a, b) {\n\n if (a.isMelindaRecord && b.isMelindaRecord &&\n a.f001 === b.f001) {\n debugData(`Melinda record's A f001 ${a.f001} matches Melinda record's B f001 ${a.f001}`);\n return 1;\n }\n\n if (a.isMelindaRecord && typeof b.f035MelindaIds !== 'undefined' &&\n b.f035MelindaIds.some(id => id === a.f001)) {\n debugData(`Melinda record's A f001 ${a.f001} matches record B f035 ${JSON.stringify(b.f035MelindaIds)}`);\n return 1;\n }\n\n if (b.isMelindaRecord && typeof a.f035MelindaIds !== 'undefined' &&\n a.f035MelindaIds.some(id => id === b.f001)) {\n debugData(`Melinda record's B f001 ${b.f001} matches record A f035 ${JSON.stringify(a.f035MelindaIds)}`);\n return 1;\n }\n\n if (typeof a.f035MelindaIds !== 'undefined' && typeof b.f035MelindaIds !== 'undefined' &&\n a.f035MelindaIds.some(idA => b.f035MelindaIds.some(idB => idB === idA))) {\n debugData(`Record A f035 ${JSON.stringify(a.f035MelindaIds)} matches record B f035 ${JSON.stringify(b.f035MelindaIds)}`);\n return 1;\n }\n debug(`No matching Melinda-IDs.`);\n return 0;\n }\n};\n"],"mappings":";;;;;;AA4BA;AACA;AAA0D;AA7B1D;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;AACA;AACA;AAAA,eAEe,MAAM;EAEnB,MAAMA,KAAK,GAAG,IAAAC,cAAiB,EAAC,2EAA2E,CAAC;EAC5G,MAAMC,SAAS,GAAGF,KAAK,CAACG,MAAM,CAAC,MAAM,CAAC;EAEtC,OAAO;IAACC,OAAO;IAAEC;EAAO,CAAC;EAEzB,SAASD,OAAO,CAACE,MAAM,EAAE;IAEvB,MAAMC,eAAe,GAAGD,MAAM,CAACE,GAAG,CAAC,KAAK,CAAC,CAACC,IAAI,CAACC,IAAI,IAAIA,IAAI,CAACC,KAAK,KAAK,YAAY,CAAC;IACnF,MAAM,CAACC,IAAI,CAAC,GAAGN,MAAM,CAACE,GAAG,CAAC,KAAK,CAAC,CAACK,GAAG,CAACC,KAAK,IAAIA,KAAK,CAACH,KAAK,CAAC;IAC1D,MAAMI,cAAc,GAAG,IAAAC,gCAAiB,EAACV,MAAM,CAAC;IAEhD,IACEC,eAAe,KAAKU,SAAS,IAC7BL,IAAI,KAAKK,SAAS,IAClBF,cAAc,CAACG,MAAM,GAAG,CAAC,EAAE;MAE3BlB,KAAK,CAAE,sBAAqB,CAAC;MAC7B,OAAO,CAAC,CAAC;IACX;IAEA,OAAO;MAACO,eAAe;MAAEK,IAAI;MAAEG;IAAc,CAAC;E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CAACJ,cAAc,CAAE,0BAAyBO,IAAI,CAACC,SAAS,CAACH,CAAC,CAACL,cAAc,CAAE,EAAC,CAAC;MACxH,OAAO,CAAC;IACV;IACAf,KAAK,CAAE,0BAAyB,CAAC;IACjC,OAAO,CAAC;EACV;AACF,CAAC;AAAA"}
1
+ {"version":3,"file":"melinda-identifier-factory.js","names":["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"],"sources":["../../../../src/match-detection/features/bib/melinda-identifier-factory.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 {getMelindaIdsF035} from '../../../matching-utils';\n\n// 003+001 FI-MELINDA <melinda-id>\n// 035 $a (FI-MELINDA)<melinda-id>\n// 035 $z (FI-MELINDA)<melinda-id>\n// 035 $a FCC<melinda-id>\n// 035 $z FCC<melinda-id>\n// melinda-id = 001234567\n\nexport default () => {\n\n const debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features/bib/melinda-id');\n const debugData = debug.extend('data');\n\n return {extract, compare};\n\n function extract({record, recordExternal}) {\n\n const isMelindaRecord = record.get('003').some(f003 => f003.value === 'FI-MELINDA');\n const [f001] = record.get('001').map(field => field.value);\n const f035MelindaIds = getMelindaIdsF035(record);\n\n if (\n isMelindaRecord === undefined &&\n f001 === undefined &&\n f035MelindaIds.length < 1) {\n\n debug(`${recordExternal.label} No Melinda-IDs found`);\n return {};\n }\n\n return {isMelindaRecord, f001, f035MelindaIds};\n\n }\n\n function compare(a, b) {\n\n if (a.isMelindaRecord && b.isMelindaRecord &&\n a.f001 === b.f001) {\n debugData(`Melinda record's A f001 ${a.f001} matches Melinda record's B f001 ${a.f001}`);\n return 1;\n }\n\n if (a.isMelindaRecord && typeof b.f035MelindaIds !== 'undefined' &&\n b.f035MelindaIds.some(id => id === a.f001)) {\n debugData(`Melinda record's A f001 ${a.f001} matches record B f035 ${JSON.stringify(b.f035MelindaIds)}`);\n return 1;\n }\n\n if (b.isMelindaRecord && typeof a.f035MelindaIds !== 'undefined' &&\n a.f035MelindaIds.some(id => id === b.f001)) {\n debugData(`Melinda record's B f001 ${b.f001} matches record A f035 ${JSON.stringify(a.f035MelindaIds)}`);\n return 1;\n }\n\n if (typeof a.f035MelindaIds !== 'undefined' && typeof b.f035MelindaIds !== 'undefined' &&\n a.f035MelindaIds.some(idA => b.f035MelindaIds.some(idB => idB === idA))) {\n debugData(`Record A f035 ${JSON.stringify(a.f035MelindaIds)} matches record B f035 ${JSON.stringify(b.f035MelindaIds)}`);\n return 1;\n }\n debug(`No matching Melinda-IDs.`);\n return 0;\n }\n};\n"],"mappings":";;;;;;AA4BA;AACA;AAA0D;AA7B1D;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;AACA;AACA;AAAA,eAEe,MAAM;EAEnB,MAAMA,KAAK,GAAG,IAAAC,cAAiB,EAAC,2EAA2E,CAAC;EAC5G,MAAMC,SAAS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BAAyBW,IAAI,CAACC,SAAS,CAACH,CAAC,CAACN,cAAc,CAAE,EAAC,CAAC;MACxG,OAAO,CAAC;IACV;IAEA,IAAIM,CAAC,CAACd,eAAe,IAAI,OAAOa,CAAC,CAACL,cAAc,KAAK,WAAW,IAC5DK,CAAC,CAACL,cAAc,CAACN,IAAI,CAACa,EAAE,IAAIA,EAAE,KAAKD,CAAC,CAACT,IAAI,CAAC,EAAE;MAC9CX,SAAS,CAAE,2BAA0BoB,CAAC,CAACT,IAAK,0BAAyBW,IAAI,CAACC,SAAS,CAACJ,CAAC,CAACL,cAAc,CAAE,EAAC,CAAC;MACxG,OAAO,CAAC;IACV;IAEA,IAAI,OAAOK,CAAC,CAACL,cAAc,KAAK,WAAW,IAAI,OAAOM,CAAC,CAACN,cAAc,KAAK,WAAW,IACjFK,CAAC,CAACL,cAAc,CAACN,IAAI,CAACgB,GAAG,IAAIJ,CAAC,CAACN,cAAc,CAACN,IAAI,CAACiB,GAAG,IAAIA,GAAG,KAAKD,GAAG,CAAC,CAAC,EAAE;MAC5ExB,SAAS,CAAE,iBAAgBsB,IAAI,CAACC,SAAS,CAACJ,CAAC,CAACL,cAAc,CAAE,0BAAyBQ,IAAI,CAACC,SAAS,CAACH,CAAC,CAACN,cAAc,CAAE,EAAC,CAAC;MACxH,OAAO,CAAC;IACV;IACAhB,KAAK,CAAE,0BAAyB,CAAC;IACjC,OAAO,CAAC;EACV;AACF,CAAC;AAAA"}
@@ -32,7 +32,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
32
32
  * @licend The above is the entire license notice
33
33
  * for the JavaScript code in this file.
34
34
  *
35
- */var _default = () => {
35
+ */
36
+ var _default = () => {
36
37
  const {
37
38
  extract,
38
39
  compare
@@ -1 +1 @@
1
- {"version":3,"file":"other-standard-identifier.js","names":["extract","compare","createInterface","pattern","subfieldCodes","name"],"sources":["../../../../src/match-detection/features/bib/other-standard-identifier.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 createInterface from './standard-identifier-factory';\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":";;;;;;AA4BA;AAA4D;AA5B5D;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,EA1BA,eA8Be,MAAM;EACnB,MAAM;IAACA,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;AAAA"}
1
+ {"version":3,"file":"other-standard-identifier.js","names":["extract","compare","createInterface","pattern","subfieldCodes","name"],"sources":["../../../../src/match-detection/features/bib/other-standard-identifier.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 createInterface from './standard-identifier-factory';\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":";;;;;;AA4BA;AAA4D;AA5B5D;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;AA1BA,eA8Be,MAAM;EACnB,MAAM;IAACA,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;AAAA"}
@@ -36,7 +36,9 @@ var _matchingUtils = require("../../../matching-utils");
36
36
  // We could also enable matching of records which have consequent publication years
37
37
  var _default = () => ({
38
38
  name: 'Publication time',
39
- extract: record => {
39
+ extract: ({
40
+ record
41
+ }) => {
40
42
  var _record$get, _record$get$;
41
43
  const value = ((_record$get = record.get(/^008$/u)) === null || _record$get === void 0 ? void 0 : (_record$get$ = _record$get[0]) === null || _record$get$ === void 0 ? void 0 : _record$get$.value) || undefined;
42
44
  return (0, _matchingUtils.testStringOrNumber)(value) ? [String(value).slice(7, 11)] : [];
@@ -1 +1 @@
1
- {"version":3,"file":"publication-time.js","names":["name","extract","record","value","get","undefined","testStringOrNumber","String","slice","compare","a","b"],"sources":["../../../../src/match-detection/features/bib/publication-time.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\nimport {testStringOrNumber} from '../../../matching-utils';\n\n// We should also get copyright time and copyright/publication times from 26x\n// We could also enable matching of records which have consequent publication years\n\nexport default () => ({\n name: 'Publication time',\n extract: record => {\n const value = record.get(/^008$/u)?.[0]?.value || undefined;\n return testStringOrNumber(value) ? [String(value).slice(7, 11)] : [];\n },\n compare: (a, b) => a[0] === b[0] ? 0.1 : -1.0\n});\n"],"mappings":";;;;;;AA4BA;AA5BA;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;AAIA;AACA;AAAA,eAEe,OAAO;EACpBA,IAAI,EAAE,kBAAkB;EACxBC,OAAO,EAAEC,MAAM,IAAI;IAAA;IACjB,MAAMC,KAAK,GAAG,gBAAAD,MAAM,CAACE,GAAG,CAAC,QAAQ,CAAC,gEAApB,YAAuB,CAAC,CAAC,iDAAzB,aAA2BD,KAAK,KAAIE,SAAS;IAC3D,OAAO,IAAAC,iCAAkB,EAACH,KAAK,CAAC,GAAG,CAACI,MAAM,CAACJ,KAAK,CAAC,CAACK,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE;EACtE,CAAC;EACDC,OAAO,EAAE,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAAC,CAAC,CAAC,KAAKC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC;AAC5C,CAAC,CAAC;AAAA"}
1
+ {"version":3,"file":"publication-time.js","names":["name","extract","record","value","get","undefined","testStringOrNumber","String","slice","compare","a","b"],"sources":["../../../../src/match-detection/features/bib/publication-time.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\nimport {testStringOrNumber} from '../../../matching-utils';\n\n// We should also get copyright time and copyright/publication times from 26x\n// We could also enable matching of records which have consequent publication years\n\nexport default () => ({\n name: 'Publication time',\n extract: ({record}) => {\n const value = record.get(/^008$/u)?.[0]?.value || undefined;\n return testStringOrNumber(value) ? [String(value).slice(7, 11)] : [];\n },\n compare: (a, b) => a[0] === b[0] ? 0.1 : -1.0\n});\n"],"mappings":";;;;;;AA4BA;AA5BA;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;AAIA;AACA;AAAA,eAEe,OAAO;EACpBA,IAAI,EAAE,kBAAkB;EACxBC,OAAO,EAAE,CAAC;IAACC;EAAM,CAAC,KAAK;IAAA;IACrB,MAAMC,KAAK,GAAG,gBAAAD,MAAM,CAACE,GAAG,CAAC,QAAQ,CAAC,gEAApB,YAAuB,CAAC,CAAC,iDAAzB,aAA2BD,KAAK,KAAIE,SAAS;IAC3D,OAAO,IAAAC,iCAAkB,EAACH,KAAK,CAAC,GAAG,CAACI,MAAM,CAACJ,KAAK,CAAC,CAACK,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE;EACtE,CAAC;EACDC,OAAO,EAAE,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAAC,CAAC,CAAC,KAAKC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC;AAC5C,CAAC,CAAC;AAAA"}
@@ -34,7 +34,9 @@ exports.default = void 0;
34
34
  // we could handle the case of books/notes
35
35
  var _default = () => ({
36
36
  name: 'Record type',
37
- extract: r => r.leader[6] ? [r.leader[6]] : [],
37
+ extract: ({
38
+ record
39
+ }) => record.leader[6] ? [record.leader[6]] : [],
38
40
  compare: (a, b) => a[0] === b[0] ? 0.1 : -0.5
39
41
  });
40
42
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"file":"record-type.js","names":["name","extract","r","leader","compare","a","b"],"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\nexport default () => ({\n name: 'Record type',\n extract: r => r.leader[6] ? [r.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;AAAA,eAEe,OAAO;EACpBA,IAAI,EAAE,aAAa;EACnBC,OAAO,EAAEC,CAAC,IAAIA,CAAC,CAACC,MAAM,CAAC,CAAC,CAAC,GAAG,CAACD,CAAC,CAACC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE;EAC9CC,OAAO,EAAE,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAAC,CAAC,CAAC,KAAKC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC;AAC5C,CAAC,CAAC;AAAA"}
1
+ {"version":3,"file":"record-type.js","names":["name","extract","record","leader","compare","a","b"],"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\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;AAAA,eAEe,OAAO;EACpBA,IAAI,EAAE,aAAa;EACnBC,OAAO,EAAE,CAAC;IAACC;EAAM,CAAC,KAAKA,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,GAAG,CAACD,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE;EACjEC,OAAO,EAAE,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAAC,CAAC,CAAC,KAAKC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC;AAC5C,CAAC,CAAC;AAAA"}
@@ -45,7 +45,9 @@ var _default = ({
45
45
  extract,
46
46
  compare
47
47
  };
48
- function extract(record) {
48
+ function extract({
49
+ record
50
+ }) {
49
51
  const [field] = record.get(pattern);
50
52
  if (field) {
51
53
  return field.subfields.filter(({