@natlibfi/melinda-record-matching 4.1.1 → 4.1.2-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 (36) hide show
  1. package/dist/candidate-search/candidate-search-utils.js.map +1 -1
  2. package/dist/candidate-search/index.js.map +1 -1
  3. package/dist/candidate-search/index.spec.js.map +1 -1
  4. package/dist/candidate-search/query-list/bib.js.map +1 -1
  5. package/dist/candidate-search/query-list/bib.spec.js.map +1 -1
  6. package/dist/candidate-search/query-list/index.js.map +1 -1
  7. package/dist/index.js +4 -2
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.spec.js +8 -8
  10. package/dist/index.spec.js.map +1 -1
  11. package/dist/match-detection/features/bib/all-source-ids.js.map +1 -1
  12. package/dist/match-detection/features/bib/authors.js.map +1 -1
  13. package/dist/match-detection/features/bib/bibliographic-level.js.map +1 -1
  14. package/dist/match-detection/features/bib/host-component.js.map +1 -1
  15. package/dist/match-detection/features/bib/index.js.map +1 -1
  16. package/dist/match-detection/features/bib/index.spec.js.map +1 -1
  17. package/dist/match-detection/features/bib/isbn.js.map +1 -1
  18. package/dist/match-detection/features/bib/issn.js.map +1 -1
  19. package/dist/match-detection/features/bib/language.js.map +1 -1
  20. package/dist/match-detection/features/bib/melinda-id.js.map +1 -1
  21. package/dist/match-detection/features/bib/melinda-identifier-factory.js.map +1 -1
  22. package/dist/match-detection/features/bib/other-standard-identifier.js.map +1 -1
  23. package/dist/match-detection/features/bib/publication-time-allow-cons-years-multi.js.map +1 -1
  24. package/dist/match-detection/features/bib/publication-time-allow-cons-years.js.map +1 -1
  25. package/dist/match-detection/features/bib/publication-time.js.map +1 -1
  26. package/dist/match-detection/features/bib/record-type.js.map +1 -1
  27. package/dist/match-detection/features/bib/standard-identifier-factory.js.map +1 -1
  28. package/dist/match-detection/features/bib/title-version-original.js.map +1 -1
  29. package/dist/match-detection/features/bib/title.js.map +1 -1
  30. package/dist/match-detection/features/index.js.map +1 -1
  31. package/dist/match-detection/index.js.map +1 -1
  32. package/dist/match-detection/index.spec.js.map +1 -1
  33. package/dist/matching-utils.js.map +1 -1
  34. package/package.json +13 -12
  35. package/src/index.js +1 -1
  36. package/src/index.spec.js +5 -8
@@ -1 +1 @@
1
- {"version":3,"file":"index.spec.js","names":["debug","createDebugLogger","debugData","extend","describe","generateTests","callback","path","__dirname","recurse","fixura","reader","READERS","JSON","getFixture","options","enabled","expectedMatchStatus","expectedStopReason","expectedFailures","record","MarcRecord","subfieldValues","expectedMatches","expectedNonMatches","match","createMatchInterface","formatOptions","matches","matchStatus","nonMatches","conversionFailures","length","status","stopReason","expect","to","eql","formattedMatchResult","formatRecordResults","formattedNonMatchResult","contextFeatures","matchDetection","features","detection","strategy","type","search","detect","map","v","stringify","candidate","formatCandidate","id","newId","newRecord","toObject"],"sources":["../src/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-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 {expect} from 'chai';\nimport {READERS} from '@natlibfi/fixura';\nimport generateTests from '@natlibfi/fixugen-http-client';\nimport {MarcRecord} from '@natlibfi/marc-record';\nimport createMatchInterface, {matchDetection} from '.';\nimport createDebugLogger from 'debug';\n\nconst debug = createDebugLogger('@natlibfi/melinda-record-matching:index:test');\nconst debugData = debug.extend('data');\n\ndescribe('INDEX', () => {\n generateTests({\n callback,\n path: [__dirname, '..', 'test-fixtures', 'index'],\n recurse: false,\n fixura: {\n reader: READERS.JSON\n }\n });\n\n async function callback({getFixture, options, enabled = true, expectedMatchStatus, expectedStopReason, expectedFailures}) {\n\n if (!enabled) {\n debug(`Disabled test!`);\n return;\n }\n\n const record = new MarcRecord(getFixture('inputRecord.json'), {subfieldValues: false});\n const expectedMatches = getFixture('expectedMatches.json');\n const expectedNonMatches = getFixture('expectedNonMatches.json') || [];\n\n\n const match = createMatchInterface(formatOptions());\n const {matches, matchStatus, nonMatches, conversionFailures} = await match({record});\n debugData(`Matches: ${matches.length}, Status: ${matchStatus.status}/${matchStatus.stopReason}, NonMatches: ${nonMatches ? nonMatches.length : 'not returned'}, ConversionFailures: ${conversionFailures ? conversionFailures.length : 'not returned'}`);\n\n expect(matchStatus.status).to.eql(expectedMatchStatus);\n expect(matchStatus.stopReason).to.eql(expectedStopReason);\n\n const formattedMatchResult = formatRecordResults(matches);\n expect(formattedMatchResult).to.eql(expectedMatches);\n\n const formattedNonMatchResult = formatRecordResults(nonMatches);\n expect(formattedNonMatchResult).to.eql(expectedNonMatches);\n\n // eslint-disable-next-line functional/no-conditional-statement\n if (expectedFailures) {\n expect(conversionFailures).to.eql(expectedFailures);\n }\n\n function formatOptions() {\n const contextFeatures = matchDetection.features[options.detection.strategy.type];\n\n return {\n ...options,\n search: {\n ...options.search\n },\n detection: {\n ...options.detect,\n strategy: options.detection.strategy.features.map(v => contextFeatures[v]())\n }\n };\n }\n\n function formatRecordResults(matches) {\n if (matches) {\n debugData(JSON.stringify(matches));\n return matches.map((match) => ({\n ...match,\n candidate: formatCandidate(match.candidate)\n }));\n }\n return [];\n }\n\n // Format candidate to remove validationOptions from record\n function formatCandidate({id, record}) {\n const newId = id;\n const newRecord = record;\n return {\n id: newId,\n record: newRecord.toObject()\n };\n }\n\n\n }\n\n});\n"],"mappings":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,CAACX,OAAO,EAAE;MACpC,IAAIA,OAAO,EAAE;QACX1B,SAAS,CAACW,IAAI,CAACsC,SAAS,CAACvB,OAAO,CAAC,CAAC;QAClC,OAAOA,OAAO,CAACqB,GAAG,CAAExB,KAAK,KAAM;UAC7B,GAAGA,KAAK;UACR2B,SAAS,EAAEC,eAAe,CAAC5B,KAAK,CAAC2B,SAAS;QAC5C,CAAC,CAAC,CAAC;MACL;MACA,OAAO,EAAE;IACX;;IAEA;IACA,SAASC,eAAe,CAAC;MAACC,EAAE;MAAElC;IAAM,CAAC,EAAE;MACrC,MAAMmC,KAAK,GAAGD,EAAE;MAChB,MAAME,SAAS,GAAGpC,MAAM;MACxB,OAAO;QACLkC,EAAE,EAAEC,KAAK;QACTnC,MAAM,EAAEoC,SAAS,CAACC,QAAQ;MAC5B,CAAC;IACH;EAGF;AAEF,CAAC,CAAC"}
1
+ {"version":3,"file":"index.spec.js","names":["_chai","require","_fixura","_fixugenHttpClient","_interopRequireDefault","_marcRecord","_","_interopRequireWildcard","_debug","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","debug","createDebugLogger","debugData","extend","describe","generateTests","callback","path","__dirname","recurse","fixura","reader","READERS","JSON","getFixture","options","expectedMatchStatus","expectedStopReason","expectedFailures","expectedCandidateCount","record","MarcRecord","subfieldValues","expectedMatches","expectedNonMatches","match","createMatchInterface","formatOptions","matches","matchStatus","nonMatches","conversionFailures","candidateCount","length","status","stopReason","expect","to","eql","formattedMatchResult","formatRecordResults","formattedNonMatchResult","contextFeatures","matchDetection","features","detection","strategy","type","search","detect","map","v","stringify","candidate","formatCandidate","id","newId","newRecord","toObject"],"sources":["../src/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-2023 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-record-matching-js\n*\n* melinda-record-matching-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-record-matching-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Affero General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nimport {expect} from 'chai';\nimport {READERS} from '@natlibfi/fixura';\nimport generateTests from '@natlibfi/fixugen-http-client';\nimport {MarcRecord} from '@natlibfi/marc-record';\nimport createMatchInterface, {matchDetection} from '.';\nimport createDebugLogger from 'debug';\n\nconst debug = createDebugLogger('@natlibfi/melinda-record-matching:index:test');\nconst debugData = debug.extend('data');\n\ndescribe('INDEX', () => {\n generateTests({\n callback,\n path: [__dirname, '..', 'test-fixtures', 'index'],\n recurse: false,\n fixura: {\n reader: READERS.JSON\n }\n });\n\n // eslint-disable-next-line max-statements\n async function callback({getFixture, options, expectedMatchStatus, expectedStopReason, expectedFailures, expectedCandidateCount}) {\n\n const record = new MarcRecord(getFixture('inputRecord.json'), {subfieldValues: false});\n const expectedMatches = getFixture('expectedMatches.json');\n const expectedNonMatches = getFixture('expectedNonMatches.json') || [];\n\n\n const match = createMatchInterface(formatOptions());\n const {matches, matchStatus, nonMatches, conversionFailures, candidateCount} = await match({record});\n debugData(`Matches: ${matches.length}, Status: ${matchStatus.status}/${matchStatus.stopReason}, NonMatches: ${nonMatches ? nonMatches.length : 'not returned'}, ConversionFailures: ${conversionFailures ? conversionFailures.length : 'not returned'}`);\n\n expect(matchStatus.status).to.eql(expectedMatchStatus);\n expect(matchStatus.stopReason).to.eql(expectedStopReason);\n expect(candidateCount).to.eql(expectedCandidateCount);\n\n const formattedMatchResult = formatRecordResults(matches);\n expect(formattedMatchResult).to.eql(expectedMatches);\n\n const formattedNonMatchResult = formatRecordResults(nonMatches);\n expect(formattedNonMatchResult).to.eql(expectedNonMatches);\n\n // eslint-disable-next-line functional/no-conditional-statement\n if (expectedFailures) {\n expect(conversionFailures).to.eql(expectedFailures);\n }\n\n function formatOptions() {\n const contextFeatures = matchDetection.features[options.detection.strategy.type];\n\n return {\n ...options,\n search: {\n ...options.search\n },\n detection: {\n ...options.detect,\n strategy: options.detection.strategy.features.map(v => contextFeatures[v]())\n }\n };\n }\n\n function formatRecordResults(matches) {\n if (matches) {\n debugData(JSON.stringify(matches));\n return matches.map((match) => ({\n ...match,\n candidate: formatCandidate(match.candidate)\n }));\n }\n return [];\n }\n\n // Format candidate to remove validationOptions from record\n function formatCandidate({id, record}) {\n const newId = id;\n const newRecord = record;\n return {\n id: newId,\n record: newRecord.toObject()\n };\n }\n\n\n }\n\n});\n"],"mappings":";;AA4BA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,kBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,CAAA,GAAAC,uBAAA,CAAAN,OAAA;AACA,IAAAO,MAAA,GAAAJ,sBAAA,CAAAH,OAAA;AAAsC,SAAAQ,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAH,wBAAAO,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,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rC,MAAM;MACxB,OAAO;QACLmC,EAAE,EAAEC,KAAK;QACTpC,MAAM,EAAEqC,SAAS,CAACC,QAAQ;MAC5B,CAAC;IACH;EAGF;AAEF,CAAC,CAAC"}
@@ -1 +1 @@
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,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,EAAE,CAAC;IAACC,MAAM;IAAEC;EAAc,CAAC,KAAK;IACrC,MAAMC,KAAK,GAAGD,cAAc,IAAIA,cAAc,CAACC,KAAK,GAAGD,cAAc,CAACC,KAAK,GAAG,QAAQ;IACtFR,KAAK,CAAE,mEAAkEQ,KAAM,EAAC,CAAC;IAEjF,MAAMC,KAAK,GAAGH,MAAM,CAACI,GAAG,CAAC,KAAK,CAAC;IAC/BR,SAAS,CAAE,eAAcO,KAAK,CAACE,MAAO,MAAKC,IAAI,CAACC,SAAS,CAACJ,KAAK,CAAE,EAAC,CAAC;IAEnE,MAAMK,WAAW,GAAGC,cAAc,CAACN,KAAK,CAAC;IACzCP,SAAS,CAAE,iBAAgBY,WAAW,CAACH,MAAO,MAAKC,IAAI,CAACC,SAA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QAAQ,KAAKD,IAAI,CAACC,QAAQ,IACvEH,IAAI,CAACI,QAAQ,KAAKF,IAAI,CAACE,QAAQ,CAAC,CAAC;IACzChC,SAAS,CAAE,YAAW2B,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;IACnChC,SAAS,CAAE,eAAciC,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","_interopRequireDefault","require","_matchingUtils","obj","__esModule","default","debug","createDebugLogger","debugData","extend","_default","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","exports"],"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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAA0F,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AA7B1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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QAAQ,CAAC,CAAC;IACnCjC,SAAS,CAAE,eAAckC,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;AAAAyB,OAAA,CAAAtC,OAAA,GAAAK,QAAA"}
@@ -1 +1 @@
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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G,CAAC,CAAC,CAACjC,GAAG,CAACoC,CAAC,IAAIA,CAAC,CAACH,GAAG,CAAC,CAAC;MACtD,MAAMI,OAAO,GAAGpB,CAAC,CAACf,MAAM,CAACkC,CAAC,IAAIA,CAAC,CAACH,GAAG,CAAC,CAAC,CAACjC,GAAG,CAACoC,CAAC,IAAIA,CAAC,CAACH,GAAG,CAAC,CAAC;MACtD,MAAMK,SAAS,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"}
1
+ {"version":3,"file":"authors.js","names":["_natural","require","_matchingUtils","_default","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","exports","default"],"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,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;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,IAAAE,QAAA,GAEeA,CAAC;EAACC,YAAY,GAAG;AAAE,CAAC,GAAG,CAAC,CAAC,MAAM;EAC5CC,IAAI,EAAE,SAAS;EACfC,OAAO,EAAEA,CAAC;IAACC;EAAM,CAAC,KAAK;IACrB;IACA,MAAMC,OAAO,GAAGD,MAAM,CAACE,GAAG,CAAC,oBAAoB,CAAC,CAC7CC,GAAG,CAAC,CAAC;MAACC;IAAS,CAAC,KAAK;MACpB,OAAOA,SAAS,CACbC,MAAM,CAAC,CAAC;QAACC,IAAI;QAAEC;MAAK,CAAC,KAAKD,IAAI,IAAIC,KAAK,CAAC,CACxCF,MAAM,CAAC,CAAC;QAACC;MAAI,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAACE,QAAQ,CAACF,IAAI,CAAC,CAAC,CAC7CH,GAAG,CAACM,KAAK,CAAC,CACVC,MAAM,CAAC,CAACC,GAAG,EAAEC,CAAC,MAAM;QAAC,GAAGD,GAAG;QAAE,GAAGC;MAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;MAE3C,SAASH,KAAKA,CAAC;QAACH,IAAI;QAAEC;MAAK,CAAC,EAAE;QAC5B,IAAID,IAAI,KAAK,GAAG,EAAE;UAChB,OAAO;YAACR,IAAI,EAAE,IAAAe,iCAAkB,EAACN,KA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,GAAGE,SAAS,GAAG,GAAG;QAE7C,OAAOE,UAAU,IAAItC,YAAY;QAEjC,SAASqC,YAAYA,CAAA,EAAG;UACtB,OAAOf,CAAC,CAACG,MAAM,GAAGF,CAAC,CAACE,MAAM,GAAGH,CAAC,CAACG,MAAM,GAAGF,CAAC,CAACE,MAAM;QAClD;MACF,CAAC,CAAC;IACJ;IAEA,SAASQ,WAAWA,CAACM,GAAG,EAAEC,EAAE,EAAE;MAC5B,MAAMC,OAAO,GAAGnB,CAAC,CAACd,MAAM,CAACkC,CAAC,IAAIA,CAAC,CAACH,GAAG,CAAC,CAAC,CAACjC,GAAG,CAACoC,CAAC,IAAIA,CAAC,CAACH,GAAG,CAAC,CAAC;MACtD,MAAMI,OAAO,GAAGpB,CAAC,CAACf,MAAM,CAACkC,CAAC,IAAIA,CAAC,CAACH,GAAG,CAAC,CAAC,CAACjC,GAAG,CAACoC,CAAC,IAAIA,CAAC,CAACH,GAAG,CAAC,CAAC;MACtD,MAAMK,SAAS,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;AAAAkC,OAAA,CAAAC,OAAA,GAAAlD,QAAA"}
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"bibliographic-level.js","names":["_default","name","extract","record","leader","compare","a","b","exports","default"],"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,IAAAA,QAAA,GA4BeA,CAAA,MAAO;EACpBC,IAAI,EAAE,qBAAqB;EAC3BC,OAAO,EAAEA,CAAC;IAACC;EAAM,CAAC,KAAKA,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,GAAG,CAACD,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE;EACjEC,OAAO,EAAEA,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAAC,CAAC,CAAC,KAAKC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC;AAC5C,CAAC,CAAC;AAAAC,OAAA,CAAAC,OAAA,GAAAT,QAAA"}
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"host-component.js","names":["_default","name","extract","record","get","length","compare","a","b","exports","default"],"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,IAAAA,QAAA,GA4BeA,CAAA,MAAO;EACpBC,IAAI,EAAE,uBAAuB;EAC7BC,OAAO,EAAEA,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,EAAEA,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAAC,CAAC,CAAC,KAAKC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC;AAC5C,CAAC,CAAC;AAAAC,OAAA,CAAAC,OAAA,GAAAV,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../src/match-detection/features/bib/index.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 as hostComponent} from './host-component';\nexport {default as isbn} from './isbn';\nexport {default as issn} from './issn';\nexport {default as otherStandardIdentifier} from './other-standard-identifier';\nexport {default as title} from './title';\nexport {default as titleVersionOriginal} from './title-version-original';\nexport {default as authors} from './authors';\nexport {default as recordType} from './record-type';\nexport {default as publicationTime} from './publication-time';\nexport {default as publicationTimeAllowConsYears} from './publication-time-allow-cons-years';\nexport {default as publicationTimeAllowConsYearsMulti} from './publication-time-allow-cons-years-multi';\nexport {default as language} from './language';\nexport {default as bibliographicLevel} from './bibliographic-level';\nexport {default as melindaId} from './melinda-id';\nexport {default as allSourceIds} from './all-source-ids';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAyD"}
1
+ {"version":3,"file":"index.js","names":["_hostComponent","_interopRequireDefault","require","_isbn","_issn","_otherStandardIdentifier","_title","_titleVersionOriginal","_authors","_recordType","_publicationTime","_publicationTimeAllowConsYears","_publicationTimeAllowConsYearsMulti","_language","_bibliographicLevel","_melindaId","_allSourceIds","obj","__esModule","default"],"sources":["../../../../src/match-detection/features/bib/index.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 as hostComponent} from './host-component';\nexport {default as isbn} from './isbn';\nexport {default as issn} from './issn';\nexport {default as otherStandardIdentifier} from './other-standard-identifier';\nexport {default as title} from './title';\nexport {default as titleVersionOriginal} from './title-version-original';\nexport {default as authors} from './authors';\nexport {default as recordType} from './record-type';\nexport {default as publicationTime} from './publication-time';\nexport {default as publicationTimeAllowConsYears} from './publication-time-allow-cons-years';\nexport {default as publicationTimeAllowConsYearsMulti} from './publication-time-allow-cons-years-multi';\nexport {default as language} from './language';\nexport {default as bibliographicLevel} from './bibliographic-level';\nexport {default as melindaId} from './melinda-id';\nexport {default as allSourceIds} from './all-source-ids';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,KAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,wBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,MAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,qBAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,QAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,WAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,gBAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,8BAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,mCAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,SAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,mBAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,UAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,aAAA,GAAAf,sBAAA,CAAAC,OAAA;AAAyD,SAAAD,uBAAAgB,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA"}
@@ -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\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"}
1
+ {"version":3,"file":"index.spec.js","names":["_fixugen","_interopRequireDefault","require","_fixura","_chai","_marcRecord","features","_interopRequireWildcard","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","describe","generateTests","path","__dirname","useMetadataFile","fixura","reader","READERS","JSON","callback","enabled","feature","options","type","expectations","expectedFeatures","inputRecord","record","MarcRecord","subfieldValues","extract","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,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAC,uBAAA,CAAAL,OAAA;AAA8B,SAAAM,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAF,wBAAAM,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EAAAW,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAV,GAAA,EAAAW,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV,GAAA,IAAAU,IAAA,CAAAC,GAAA,KAAAR,MAAA,CAAAC,cAAA,CAAAH,MAAA,EAAAK,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AC,CAACK,EAAE,CAACC,GAAG,CAACR,gBAAgB,CAAC;QAClD;MACF;MAEA,IAAIF,IAAI,KAAK,SAAS,EAAE;QACtB,MAAM;UAACW,SAAS;UAAEC,SAAS;UAAEC;QAAc,CAAC,GAAGZ,YAAY;QAC3D,MAAM;UAACa;QAAO,CAAC,GAAGnD,QAAQ,CAACmC,OAAO,CAAC,CAACC,OAAO,CAAC;QAE5C,IAAAS,YAAM,EAACM,OAAO,CAACH,SAAS,EAAEC,SAAS,CAAC,CAAC,CAACH,EAAE,CAACM,KAAK,CAACF,cAAc,CAAC;QAC9D;MACF;MAEA,MAAM,IAAIG,KAAK,CAAE,gBAAehB,IAAK,EAAC,CAAC;IACzC;EACF,CAAC,CAAC;AACJ,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"isbn.js","names":["debug","createDebugLogger","debugData","extend","IDENTIFIER_NAME","validatorAndNormalizer","string","isbnParseResult","isbnParse","JSON","stringify","valid","value","replace","isbn13","extract","compare","createInterface","identifier","pattern","subfieldCodes","validIdentifierSubfieldCodes","invalidIdentifierSubfieldCodes","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';\nimport {parse as isbnParse} from 'isbn3';\nimport createDebugLogger from 'debug';\n\nconst debug = createDebugLogger(`@natlibfi/melinda-record-matching:match-detection:features:standard-identifiers:ISBN`);\nconst debugData = debug.extend('data');\n\nexport default () => {\n const IDENTIFIER_NAME = 'ISBN';\n\n function validatorAndNormalizer(string) {\n const isbnParseResult = isbnParse(string);\n debugData(`isbnParseResult: ${JSON.stringify(isbnParseResult)}`);\n if (isbnParseResult === null) {\n debug(`Not parseable ISBN, just removing hyphens`);\n return {valid: false, value: string.replace(/-/ug, '')};\n }\n debug(`Parseable ISBN, normalizing to ISBN-13`);\n return {valid: true, value: isbnParseResult.isbn13};\n }\n\n const {extract, compare} = createInterface({identifier: IDENTIFIER_NAME, pattern: /^020$/u, subfieldCodes: ['a', 'z'], validIdentifierSubfieldCodes: ['a'], invalidIdentifierSubfieldCodes: ['z'], validatorAndNormalizer});\n return {extract, compare, name: IDENTIFIER_NAME};\n};\n\n"],"mappings":";;;;;;AA4BA;AACA;AACA;AAAsC;AA9BtC;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;;AAMA,MAAMA,KAAK,GAAG,IAAAC,cAAiB,EAAE,sFAAqF,CAAC;AACvH,MAAMC,SAAS,GAAGF,KAAK,CAACG,MAAM,CAAC,MAAM,CAAC;AAAC,eAExB,MAAM;EACnB,MAAMC,eAAe,GAAG,MAAM;EAE9B,SAASC,sBAAsB,CAACC,MAAM,EAAE;IACtC,MAAMC,eAAe,GAAG,IAAAC,WAAS,EAACF,MAAM,CAAC;IACzCJ,SAAS,CAAE,oBAAmBO,IAAI,CAACC,SAAS,CAACH,eAAe,CAAE,EAAC,CAAC;IAChE,IAAIA,eAAe,KAAK,IAAI,EAAE;MAC5BP,KAAK,CAAE,2CAA0C,CAAC;MAClD,OAAO;QAACW,KAAK,EAAE,KAAK;QAAEC,KAAK,EAAEN,MAAM,CAACO,OAAO,CAAC,KAAK,EAAE,EAAE;MAAC,CAAC;IACzD;IACAb,KAAK,CAAE,wCAAuC,CAAC;IAC/C,OAAO;MAACW,KAAK,EAAE,IAAI;MAAEC,KAAK,EAAEL,eAAe,CAACO;IAAM,CAAC;EACrD;EAEA,MAAM;IAACC,OAAO;IAAEC;EAAO,CAAC,GAAG,IAAAC,kCAAe,EAAC;IAACC,UAAU,EAAEd,eAAe;IAAEe,OAAO,EAAE,QAAQ;IAAEC,aAAa,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;IAAEC,4BAA4B,EAAE,CAAC,GAAG,CAAC;IAAEC,8BAA8B,EAAE,CAAC,GAAG,CAAC;IAAEjB;EAAsB,CAAC,CAAC;EAC3N,OAAO;IAACU,OAAO;IAAEC,OAAO;IAAEO,IAAI,EAAEnB;EAAe,CAAC;AAClD,CAAC;AAAA"}
1
+ {"version":3,"file":"isbn.js","names":["_standardIdentifierFactory","_interopRequireDefault","require","_isbn","_debug","obj","__esModule","default","debug","createDebugLogger","debugData","extend","_default","IDENTIFIER_NAME","validatorAndNormalizer","string","isbnParseResult","isbnParse","JSON","stringify","valid","value","replace","isbn13","extract","compare","createInterface","identifier","pattern","subfieldCodes","validIdentifierSubfieldCodes","invalidIdentifierSubfieldCodes","name","exports"],"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';\nimport {parse as isbnParse} from 'isbn3';\nimport createDebugLogger from 'debug';\n\nconst debug = createDebugLogger(`@natlibfi/melinda-record-matching:match-detection:features:standard-identifiers:ISBN`);\nconst debugData = debug.extend('data');\n\nexport default () => {\n const IDENTIFIER_NAME = 'ISBN';\n\n function validatorAndNormalizer(string) {\n const isbnParseResult = isbnParse(string);\n debugData(`isbnParseResult: ${JSON.stringify(isbnParseResult)}`);\n if (isbnParseResult === null) {\n debug(`Not parseable ISBN, just removing hyphens`);\n return {valid: false, value: string.replace(/-/ug, '')};\n }\n debug(`Parseable ISBN, normalizing to ISBN-13`);\n return {valid: true, value: isbnParseResult.isbn13};\n }\n\n const {extract, compare} = createInterface({identifier: IDENTIFIER_NAME, pattern: /^020$/u, subfieldCodes: ['a', 'z'], validIdentifierSubfieldCodes: ['a'], invalidIdentifierSubfieldCodes: ['z'], validatorAndNormalizer});\n return {extract, compare, name: IDENTIFIER_NAME};\n};\n\n"],"mappings":";;;;;;AA4BA,IAAAA,0BAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AAAsC,SAAAD,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AA9BtC;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;;AAMA,MAAMG,KAAK,GAAG,IAAAC,cAAiB,EAAE,sFAAqF,CAAC;AACvH,MAAMC,SAAS,GAAGF,KAAK,CAACG,MAAM,CAAC,MAAM,CAAC;AAAC,IAAAC,QAAA,GAExBA,CAAA,KAAM;EACnB,MAAMC,eAAe,GAAG,MAAM;EAE9B,SAASC,sBAAsBA,CAACC,MAAM,EAAE;IACtC,MAAMC,eAAe,GAAG,IAAAC,WAAS,EAACF,MAAM,CAAC;IACzCL,SAAS,CAAE,oBAAmBQ,IAAI,CAACC,SAAS,CAACH,eAAe,CAAE,EAAC,CAAC;IAChE,IAAIA,eAAe,KAAK,IAAI,EAAE;MAC5BR,KAAK,CAAE,2CAA0C,CAAC;MAClD,OAAO;QAACY,KAAK,EAAE,KAAK;QAAEC,KAAK,EAAEN,MAAM,CAACO,OAAO,CAAC,KAAK,EAAE,EAAE;MAAC,CAAC;IACzD;IACAd,KAAK,CAAE,wCAAuC,CAAC;IAC/C,OAAO;MAACY,KAAK,EAAE,IAAI;MAAEC,KAAK,EAAEL,eAAe,CAACO;IAAM,CAAC;EACrD;EAEA,MAAM;IAACC,OAAO;IAAEC;EAAO,CAAC,GAAG,IAAAC,kCAAe,EAAC;IAACC,UAAU,EAAEd,eAAe;IAAEe,OAAO,EAAE,QAAQ;IAAEC,aAAa,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;IAAEC,4BAA4B,EAAE,CAAC,GAAG,CAAC;IAAEC,8BAA8B,EAAE,CAAC,GAAG,CAAC;IAAEjB;EAAsB,CAAC,CAAC;EAC3N,OAAO;IAACU,OAAO;IAAEC,OAAO;IAAEO,IAAI,EAAEnB;EAAe,CAAC;AAClD,CAAC;AAAAoB,OAAA,CAAA1B,OAAA,GAAAK,QAAA"}
@@ -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;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"}
1
+ {"version":3,"file":"issn.js","names":["_standardIdentifierFactory","_interopRequireDefault","require","obj","__esModule","default","_default","extract","compare","createInterface","pattern","subfieldCodes","name","exports"],"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,IAAAA,0BAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA4D,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;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,IAAAG,QAAA,GA8BeA,CAAA,KAAM;EACnB,MAAM;IAACC,OAAO;IAAEC;EAAO,CAAC,GAAG,IAAAC,kCAAe,EAAC;IAACC,OAAO,EAAE,QAAQ;IAAEC,aAAa,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG;EAAC,CAAC,CAAC;EAC/F,OAAO;IAACJ,OAAO;IAAEC,OAAO;IAAEI,IAAI,EAAE;EAAM,CAAC;AACzC,CAAC;AAAAC,OAAA,CAAAR,OAAA,GAAAC,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"language.js","names":["debug","createDebugLogger","debugData","extend","name","extract","record","recordExternal","label","value008","get008Value","values041","get041Values","JSON","stringify","length","allValues","undefined","concat","uniqueSortedValues","Set","sort","value","get","code","slice","isLangCodeForALanguage","filter","ind2","map","subfields","flat","langCodePattern","test","compare","a","b","every","element","index","matchingValues","possibleMatchValues","maxValues","getMatchCounts","missingCount","misMatchCount","penaltyForMissing","penaltyForMisMatch","points","Number","toFixed"],"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-2023 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-record-matching-js\n*\n* melinda-record-matching-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-record-matching-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Affero General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nimport createDebugLogger from 'debug';\nimport {getMatchCounts} from '../../../matching-utils';\n\nconst debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features:language');\nconst debugData = debug.extend('data');\n\nexport default () => ({\n name: 'Language',\n extract: ({record, recordExternal}) => {\n const label = recordExternal && recordExternal.label ? recordExternal.label : 'record';\n\n const value008 = get008Value();\n const values041 = get041Values();\n debugData(`${label} 008: ${JSON.stringify(value008)}, 041: ${JSON.stringify(values041)}`);\n\n if (!value008 && values041.length < 1) {\n debugData(`{$label} No actual values found`);\n return [];\n }\n\n const allValues = value008 === undefined ? values041 : values041.concat(value008);\n const uniqueSortedValues = [...new Set(allValues)].sort();\n\n return uniqueSortedValues;\n\n function get008Value() {\n const value = record.get(/^008$/u)?.[0]?.value || undefined;\n debugData(`${label} 008 value: ${value}`);\n\n if (!value) {\n return undefined;\n }\n\n const code = value.slice(35, 38);\n debugData(`${label} 008 code: ${code}`);\n return isLangCodeForALanguage(code) ? code : undefined;\n }\n\n // Uses only f041s that have 2nd ind ' ', which means that the codes used are MARC 21 language codes\n\n function get041Values() {\n return record.get(/^041$/u)\n .filter(({ind2}) => ind2 === ' ')\n .map(({subfields}) => subfields)\n .flat()\n .filter(({code}) => code === 'a' || code === 'd')\n .filter(({value}) => value && isLangCodeForALanguage(value))\n .map(({value}) => value);\n }\n\n // Check if a string is a possible, validly formed language code for a single language\n // Currently accept also codes in capitals\n function isLangCodeForALanguage(code) {\n if (code.length !== 3) {\n debugData(`Code ${code} is not correct length (3) for a language code.`);\n return false;\n }\n if (code === '|||' || code === ' ' || code === '^^^' || code === 'mul' || code === 'zxx') {\n debugData(`Code ${code} is not code for a spesific language.`);\n return false;\n }\n const langCodePattern = /^[a-z][a-z][a-z]$/ui;\n if (!langCodePattern.test(code)) {\n debugData(`Code ${code} is not valid as a language code`);\n return false;\n }\n return true;\n }\n\n },\n // eslint-disable-next-line max-statements\n compare: (a, b) => {\n debugData(`Comparing ${JSON.stringify(a)} and ${JSON.stringify(b)}`);\n\n if (a.length === 0 || b.length === 0) {\n debugData(`No language to compare`);\n return 0;\n }\n\n if (a.length === b.length && a.every((element, index) => element === b[index])) {\n debugData(`All languages match`);\n return 0.1;\n }\n\n const {matchingValues, possibleMatchValues, maxValues} = getMatchCounts(a, b);\n\n if (matchingValues < 1) {\n debug(`Both have languages, but none of these match.`);\n return -1.0;\n }\n debug(`Both have languages, ${matchingValues}/${possibleMatchValues} valid languages match.`);\n // ignore non-matches if there is mismatching amount of values\n debug(`Possible matches: ${possibleMatchValues}/${maxValues}`);\n //we give some kind of penalty for mismatching amount of values instead of simple divide?\n const missingCount = maxValues - possibleMatchValues;\n const misMatchCount = possibleMatchValues - matchingValues;\n debug(`\\t missing: ${missingCount}`);\n debug(`\\t mismatches: ${misMatchCount}`);\n\n const penaltyForMissing = 0.02 * (maxValues - possibleMatchValues);\n const penaltyForMisMatch = 0.05 * (possibleMatchValues - matchingValues);\n debug(`\\t points: penaltyForMissing: ${penaltyForMissing}`);\n debug(`\\t points: penaltyForMisMatch: ${penaltyForMisMatch}`);\n\n const points = Number(Number(0.1 - penaltyForMisMatch - penaltyForMissing).toFixed(2));\n debug(`Total points: ${points}`);\n\n return points;\n }\n});\n"],"mappings":";;;;;;AA4BA;AACA;AAAuD;AA7BvD;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,qEAAqE,CAAC;AACtG,MAAMC,SAAS,GAAGF,KAAK,CAACG,MAAM,CAAC,MAAM,CAAC;AAAC,eAExB,OAAO;EACpBC,IAAI,EAAE,UAAU;EAChBC,OAAO,EAAE,CAAC;IAACC,MAAM;IAAEC;EAAc,CAAC,KAAK;IACrC,MAAMC,KAAK,GAAGD,cAAc,IAAIA,cAAc,CAACC,KAAK,GAAGD,cAAc,CAACC,KAAK,GAAG,QAAQ;IAEtF,MAAMC,QAAQ,GAAGC,WAAW,EAAE;IAC9B,MAAMC,SAAS,GAAGC,YAAY,EAAE;IAChCV,SAAS,CAAE,GAAEM,KAAM,SAAQK,IAAI,CAACC,SAAS,CAACL,QAAQ,CAAE,UAASI,IAAI,CAACC,SAAS,CAACH,SAAS,CAAE,EAAC,CAAC;IAEzF,IAAI,CAACF,QAAQ,IAAIE,SAAS,CAACI,MAAM,GAAG,CAAC,EAAE;MACrCb,SAAS,CAAE,iCAAgC,CAAC;MAC5C,OAAO,EAAE;IACX;IAEA,MAAMc,SAAS,GAAGP,QAAQ,KAAKQ,SAAS,GAAGN,SAAS,GAAGA,SAAS,CAACO,MAAM,CAACT,QAAQ,CAAC;IACjF,MAAMU,kBAAkB,GAAG,CAAC,GAAG,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,IAAGC,mBAAoB,yBAAwB,CAAC;IAC7F;IACAzC,KAAK,CAAE,qBAAoByC,mBAAoB,IAAGC,SAAU,EAAC,CAAC;IAC9D;IACA,MAAME,YAAY,GAAGF,SAAS,GAAGD,mBAAmB;IACpD,MAAMI,aAAa,GAAGJ,mBAAmB,GAAGD,cAAc;IAC1DxC,KAAK,CAAE,eAAc4C,YAAa,EAAC,CAAC;IACpC5C,KAAK,CAAE,kBAAiB6C,aAAc,EAAC,CAAC;IAExC,MAAMC,iBAAiB,GAAG,IAAI,IAAIJ,SAAS,GAAGD,mBAAmB,CAAC;IAClE,MAAMM,kBAAkB,GAAG,IAAI,IAAIN,mBAAmB,GAAGD,cAAc,CAAC;IACxExC,KAAK,CAAE,iCAAgC8C,iBAAkB,EAAC,CAAC;IAC3D9C,KAAK,CAAE,kCAAiC+C,kBAAmB,EAAC,CAAC;IAE7D,MAAMC,MAAM,GAAGC,MAAM,CAACA,MAAM,CAAC,GAAG,GAAGF,kBAAkB,GAAGD,iBAAiB,CAAC,CAACI,OAAO,CAAC,CAAC,CAAC,CAAC;IACtFlD,KAAK,CAAE,iBAAgBgD,MAAO,EAAC,CAAC;IAEhC,OAAOA,MAAM;EACf;AACF,CAAC,CAAC;AAAA"}
1
+ {"version":3,"file":"language.js","names":["_debug","_interopRequireDefault","require","_matchingUtils","obj","__esModule","default","debug","createDebugLogger","debugData","extend","_default","name","extract","record","recordExternal","label","value008","get008Value","values041","get041Values","JSON","stringify","length","allValues","undefined","concat","uniqueSortedValues","Set","sort","_record$get","_record$get$","value","get","code","slice","isLangCodeForALanguage","filter","ind2","map","subfields","flat","langCodePattern","test","compare","a","b","every","element","index","matchingValues","possibleMatchValues","maxValues","getMatchCounts","missingCount","misMatchCount","penaltyForMissing","penaltyForMisMatch","points","Number","toFixed","exports"],"sources":["../../../../src/match-detection/features/bib/language.js"],"sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Melinda record matching modules for Javascript\n*\n* Copyright (C) 2020-2023 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-record-matching-js\n*\n* melinda-record-matching-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-record-matching-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Affero General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nimport createDebugLogger from 'debug';\nimport {getMatchCounts} from '../../../matching-utils';\n\nconst debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features:language');\nconst debugData = debug.extend('data');\n\nexport default () => ({\n name: 'Language',\n extract: ({record, recordExternal}) => {\n const label = recordExternal && recordExternal.label ? recordExternal.label : 'record';\n\n const value008 = get008Value();\n const values041 = get041Values();\n debugData(`${label} 008: ${JSON.stringify(value008)}, 041: ${JSON.stringify(values041)}`);\n\n if (!value008 && values041.length < 1) {\n debugData(`{$label} No actual values found`);\n return [];\n }\n\n const allValues = value008 === undefined ? values041 : values041.concat(value008);\n const uniqueSortedValues = [...new Set(allValues)].sort();\n\n return uniqueSortedValues;\n\n function get008Value() {\n const value = record.get(/^008$/u)?.[0]?.value || undefined;\n debugData(`${label} 008 value: ${value}`);\n\n if (!value) {\n return undefined;\n }\n\n const code = value.slice(35, 38);\n debugData(`${label} 008 code: ${code}`);\n return isLangCodeForALanguage(code) ? code : undefined;\n }\n\n // Uses only f041s that have 2nd ind ' ', which means that the codes used are MARC 21 language codes\n\n function get041Values() {\n return record.get(/^041$/u)\n .filter(({ind2}) => ind2 === ' ')\n .map(({subfields}) => subfields)\n .flat()\n .filter(({code}) => code === 'a' || code === 'd')\n .filter(({value}) => value && isLangCodeForALanguage(value))\n .map(({value}) => value);\n }\n\n // Check if a string is a possible, validly formed language code for a single language\n // Currently accept also codes in capitals\n function isLangCodeForALanguage(code) {\n if (code.length !== 3) {\n debugData(`Code ${code} is not correct length (3) for a language code.`);\n return false;\n }\n if (code === '|||' || code === ' ' || code === '^^^' || code === 'mul' || code === 'zxx') {\n debugData(`Code ${code} is not code for a spesific language.`);\n return false;\n }\n const langCodePattern = /^[a-z][a-z][a-z]$/ui;\n if (!langCodePattern.test(code)) {\n debugData(`Code ${code} is not valid as a language code`);\n return false;\n }\n return true;\n }\n\n },\n // eslint-disable-next-line max-statements\n compare: (a, b) => {\n debugData(`Comparing ${JSON.stringify(a)} and ${JSON.stringify(b)}`);\n\n if (a.length === 0 || b.length === 0) {\n debugData(`No language to compare`);\n return 0;\n }\n\n if (a.length === b.length && a.every((element, index) => element === b[index])) {\n debugData(`All languages match`);\n return 0.1;\n }\n\n const {matchingValues, possibleMatchValues, maxValues} = getMatchCounts(a, b);\n\n if (matchingValues < 1) {\n debug(`Both have languages, but none of these match.`);\n return -1.0;\n }\n debug(`Both have languages, ${matchingValues}/${possibleMatchValues} valid languages match.`);\n // ignore non-matches if there is mismatching amount of values\n debug(`Possible matches: ${possibleMatchValues}/${maxValues}`);\n //we give some kind of penalty for mismatching amount of values instead of simple divide?\n const missingCount = maxValues - possibleMatchValues;\n const misMatchCount = possibleMatchValues - matchingValues;\n debug(`\\t missing: ${missingCount}`);\n debug(`\\t mismatches: ${misMatchCount}`);\n\n const penaltyForMissing = 0.02 * (maxValues - possibleMatchValues);\n const penaltyForMisMatch = 0.05 * (possibleMatchValues - matchingValues);\n debug(`\\t points: penaltyForMissing: ${penaltyForMissing}`);\n debug(`\\t points: penaltyForMisMatch: ${penaltyForMisMatch}`);\n\n const points = Number(Number(0.1 - penaltyForMisMatch - penaltyForMissing).toFixed(2));\n debug(`Total points: ${points}`);\n\n return points;\n }\n});\n"],"mappings":";;;;;;AA4BA,IAAAA,MAAA,GAAAC,sBAAA,C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AAGC,mBAAoB,yBAAwB,CAAC;IAC7F;IACA5C,KAAK,CAAE,qBAAoB4C,mBAAoB,IAAGC,SAAU,EAAC,CAAC;IAC9D;IACA,MAAME,YAAY,GAAGF,SAAS,GAAGD,mBAAmB;IACpD,MAAMI,aAAa,GAAGJ,mBAAmB,GAAGD,cAAc;IAC1D3C,KAAK,CAAE,eAAc+C,YAAa,EAAC,CAAC;IACpC/C,KAAK,CAAE,kBAAiBgD,aAAc,EAAC,CAAC;IAExC,MAAMC,iBAAiB,GAAG,IAAI,IAAIJ,SAAS,GAAGD,mBAAmB,CAAC;IAClE,MAAMM,kBAAkB,GAAG,IAAI,IAAIN,mBAAmB,GAAGD,cAAc,CAAC;IACxE3C,KAAK,CAAE,iCAAgCiD,iBAAkB,EAAC,CAAC;IAC3DjD,KAAK,CAAE,kCAAiCkD,kBAAmB,EAAC,CAAC;IAE7D,MAAMC,MAAM,GAAGC,MAAM,CAACA,MAAM,CAAC,GAAG,GAAGF,kBAAkB,GAAGD,iBAAiB,CAAC,CAACI,OAAO,CAAC,CAAC,CAAC,CAAC;IACtFrD,KAAK,CAAE,iBAAgBmD,MAAO,EAAC,CAAC;IAEhC,OAAOA,MAAM;EACf;AACF,CAAC,CAAC;AAAAG,OAAA,CAAAvD,OAAA,GAAAK,QAAA"}
@@ -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;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"}
1
+ {"version":3,"file":"melinda-id.js","names":["_melindaIdentifierFactory","_interopRequireDefault","require","obj","__esModule","default","_default","extract","compare","createInterface","name","exports"],"sources":["../../../../src/match-detection/features/bib/melinda-id.js"],"sourcesContent":["/**\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,IAAAA,yBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA2D,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;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,IAAAG,QAAA,GA8BeA,CAAA,KAAM;EACnB,MAAM;IAACC,OAAO;IAAEC;EAAO,CAAC,GAAG,IAAAC,iCAAe,GAAE;EAC5C,OAAO;IAACF,OAAO;IAAEC,OAAO;IAAEE,IAAI,EAAE;EAAY,CAAC;AAC/C,CAAC;AAAAC,OAAA,CAAAN,OAAA,GAAAC,QAAA"}
@@ -1 +1 @@
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,GAAGF,KAAK,CAACG,MAAM,CAAC,MAAM,CAAC;EAEtC,OAAO;IAACC,OAAO;IAAEC;EAAO,CAAC;EAEzB,SAASD,OAAO,CAAC;IAACE,MAAM;IAAEC;EAAc,CAAC,EAAE;IAEzC,MAAMC,eAAe,GAAGF,MAAM,CAACG,GAAG,CAAC,KAAK,CAAC,CAACC,IAAI,CAACC,IAAI,IAAIA,IAAI,CAACC,KAAK,KAAK,YAAY,CAAC;IACnF,MAAM,CAACC,IAAI,CAAC,GAAGP,MAAM,CAACG,GAAG,CAAC,KAAK,CAAC,CAACK,GAAG,CAACC,KAAK,IAAIA,KAAK,CAACH,KAAK,CAAC;IAC1D,MAAMI,cAAc,GAAG,IAAAC,gCAAiB,EAACX,MAAM,CAAC;IAEhD,IACEE,eAAe,KAAKU,SAAS,IAC7BL,IAAI,KAAKK,SAAS,IAClBF,cAAc,CAACG,MAAM,GAAG,CAAC,EAAE;MAE3BnB,KAAK,CAAE,GAAEO,cAAc,CAACa,KAAM,uBAAsB,CAAC;MACrD,OAAO,CAAC,CAAC;IACX;IAEA,OAAO;MAACZ,eAAe;MAAEK,IAAI;MAAEG;IAAc,CAAC;EAEhD;EAEA,SAASX,OAAO,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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"}
1
+ {"version":3,"file":"melinda-identifier-factory.js","names":["_debug","_interopRequireDefault","require","_matchingUtils","obj","__esModule","default","_default","debug","createDebugLogger","debugData","extend","extract","compare","record","recordExternal","isMelindaRecord","get","some","f003","value","f001","map","field","f035MelindaIds","getMelindaIdsF035","undefined","length","label","a","b","id","JSON","stringify","idA","idB","exports"],"sources":["../../../../src/match-detection/features/bib/melinda-identifier-factory.js"],"sourcesContent":["/**\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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAA0D,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AA7B1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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AACb,eAAe,IAAI,OAAOc,CAAC,CAACN,cAAc,KAAK,WAAW,IAC5DM,CAAC,CAACN,cAAc,CAACN,IAAI,CAACa,EAAE,IAAIA,EAAE,KAAKF,CAAC,CAACR,IAAI,CAAC,EAAE;MAC9CX,SAAS,CAAE,2BAA0BmB,CAAC,CAACR,IAAK,0BAAyBW,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;AAAA4B,OAAA,CAAA9B,OAAA,GAAAC,QAAA"}
@@ -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;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"}
1
+ {"version":3,"file":"other-standard-identifier.js","names":["_standardIdentifierFactory","_interopRequireDefault","require","obj","__esModule","default","_default","extract","compare","createInterface","pattern","subfieldCodes","name","exports"],"sources":["../../../../src/match-detection/features/bib/other-standard-identifier.js"],"sourcesContent":["/**\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,IAAAA,0BAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA4D,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;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,IAAAG,QAAA,GA8BeA,CAAA,KAAM;EACnB,MAAM;IAACC,OAAO;IAAEC;EAAO,CAAC,GAAG,IAAAC,kCAAe,EAAC;IAACC,OAAO,EAAE,QAAQ;IAAEC,aAAa,EAAE,CAAC,GAAG,EAAE,GAAG;EAAC,CAAC,CAAC;EAC1F,OAAO;IAACJ,OAAO;IAAEC,OAAO;IAAEI,IAAI,EAAE;EAA2B,CAAC;AAC9D,CAAC;AAAAC,OAAA,CAAAR,OAAA,GAAAC,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"publication-time-allow-cons-years-multi.js","names":["name","extract","record","recordExternal","debug","createDebugLogger","label","f008Values","extractF008Values","JSON","stringify","f26xValues","extractF26xValues","f500Values","extractF500Years","normalYears","Set","concat","f008Date1","filter","value","sort","copyrightYears","reprintYears","combined","get","undefined","testStringOrNumber","extractF008Date1","f008Date2","extractF008Date2","f008YearType","extractF008YearType","String","slice","copyrightRegex","pubNormalSubFieldValues","extractPubNormalSubfieldValues","pubF264CopySubFieldValues","extractPubF264CopySubfieldValues","pubF260CopySubFieldValues","extractPubF260CopySubfieldValues","field","tag","ind2","map","subfields","flat","code","test","removeNonAlphaNumeric","replace","nonAlphaNumericRegex","reprintRegex","reprintFieldContents","filteredF500","content","match","extractReprintYears","contents","yearRegex","years","uniqYears","compare","a","b","firstA","firstB","firstANumber","parseInt","firstBNumber","isNaN","bNormalInANormal","aValue","some","bValue","aNormalInBNormal","bNormalInAReprint","aNormalInBReprint"],"sources":["../../../../src/match-detection/features/bib/publication-time-allow-cons-years-multi.js"],"sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Melinda record matching modules for Javascript\n*\n* Copyright (C) 2020-2023 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-record-matching-js\n*\n* melinda-record-matching-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-record-matching-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Affero General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nimport {testStringOrNumber} from '../../../matching-utils';\nimport createDebugLogger from 'debug';\n\n// We should also get copyright time and copyright/publication times from 26x\n// We should also get publishing time type from f008\n// We should get reprint times from f500 $a \"Lisäpainos/Lisäpainokset:\"\n\nexport default () => ({\n name: 'Publication time, allow consequent years, years from multiple sources',\n extract: ({record, recordExternal}) => {\n const debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features/bib/publication-time-allow-cons-years-multi');\n const label = recordExternal && recordExternal.label ? recordExternal.label : 'record';\n\n const f008Values = extractF008Values(record);\n debug(`${label} f008: ${JSON.stringify(f008Values)}`);\n\n const f26xValues = extractF26xValues(record);\n debug(`${label} f26x: ${JSON.stringify(f26xValues)}`);\n\n const f500Values = extractF500Years(record);\n debug(`${label} f500: ${JSON.stringify(f500Values)}`);\n\n // We should get copyrightYear from f008Date2 to copyrightYears when f008YearType = 'r'\n // Is the original year (f008Date2) in f008YearType === 'r' comparable to copyrightYear?\n // We should handle unknown years (here or comparison?)\n // We should handle year ranges for continuing resources / collections\n\n const normalYears = [...new Set(f26xValues.normalYears.concat(f008Values.f008Date1).filter(value => value && value !== ' ' && value !== '||||'))].sort();\n const copyrightYears = [...new Set(f26xValues.copyrightYears)].sort();\n const reprintYears = [...new Set(f500Values)].sort();\n\n const combined = {normalYears, copyrightYears, reprintYears};\n\n debug(`Combined: ${JSON.stringify(combined)}`);\n\n return combined;\n\n function extractF008Values(record) {\n // Record should have only one f008 - in case of several, we handle the first one\n const value = record.get(/^008$/u)?.[0]?.value || undefined;\n if (value && testStringOrNumber(value)) {\n const f008Date1 = extractF008Date1(value);\n const f008Date2 = extractF008Date2(value);\n const f008YearType = extractF008YearType(value);\n return {f008Date1, f008Date2, f008YearType};\n }\n return {f008Date1: undefined, f008Date2: undefined, f008YearType: undefined};\n\n function extractF008Date1(value) {\n return String(value).slice(7, 11);\n }\n\n function extractF008Date2(value) {\n return String(value).slice(11, 15);\n }\n\n function extractF008YearType(value) {\n return String(value).slice(6, 7);\n }\n }\n\n function extractF26xValues(record) {\n const copyrightRegex = /^(?<copyrightPrefix>cop|cop.|c|©|p|℗)/u;\n\n const pubNormalSubFieldValues = extractPubNormalSubfieldValues(record, copyrightRegex);\n debug(`Normal years: ${JSON.stringify(pubNormalSubFieldValues)}`);\n\n const pubF264CopySubFieldValues = extractPubF264CopySubfieldValues(record);\n debug(`F264 copyright years: ${JSON.stringify(pubF264CopySubFieldValues)}`);\n\n const pubF260CopySubFieldValues = extractPubF260CopySubfieldValues(record, copyrightRegex);\n debug(`F260 copyright years: ${JSON.stringify(pubF260CopySubFieldValues)}`);\n\n return {normalYears: pubNormalSubFieldValues, copyrightYears: [...pubF260CopySubFieldValues, ...pubF264CopySubFieldValues]};\n\n function extractPubNormalSubfieldValues(record, copyrightRegex) {\n return record.get(/^26[04]$/u)\n .filter((field) => !(field.tag === '264' && field.ind2 === '4'))\n .map(({subfields}) => subfields)\n .flat()\n .filter(({code}) => code && code === 'c')\n .filter(({value}) => value && !copyrightRegex.test(value))\n .map(({value}) => value)\n .map((value) => removeNonAlphaNumeric(value));\n }\n\n function extractPubF264CopySubfieldValues(record, copyrightRegex) {\n return record.get(/^264$/u)\n .filter((field) => field.ind2 === '4')\n .map(({subfields}) => subfields)\n .flat()\n .filter(({code}) => code && code === 'c')\n .filter(({value}) => value)\n .map(({value}) => value)\n .map((value) => value.replace(copyrightRegex, ''))\n .map((value) => removeNonAlphaNumeric(value));\n }\n\n function extractPubF260CopySubfieldValues(record, copyrightRegex) {\n return record.get(/^260$/u)\n .map(({subfields}) => subfields)\n .flat()\n .filter(({code}) => code && code === 'c')\n .filter(({value}) => value && copyrightRegex.test(value))\n .map(({value}) => value)\n .map((value) => value.replace(copyrightRegex, ''))\n .map((value) => removeNonAlphaNumeric(value));\n }\n\n function removeNonAlphaNumeric(value) {\n debug(`Cleaning: ${JSON.stringify(value)}`);\n const nonAlphaNumericRegex = /[^A-Za-z0-9]/ug;\n return value ? value.replace(nonAlphaNumericRegex, '') : value;\n }\n }\n\n function extractF500Years(record) {\n\n const reprintRegex = /(?<reprint>Lisäpainokset:|Lisäpainos:)/u;\n const reprintFieldContents = record.get(/^500$/u)\n .map(({subfields}) => subfields)\n .flat()\n .filter(({code}) => code === 'a')\n .map(({value}) => value);\n //.filter(value => value.test(reprintRegex));\n\n debug(`f500 reprint field contents: ${JSON.stringify(reprintFieldContents)}`);\n\n const filteredF500 = reprintFieldContents.filter((content) => content && content.match(reprintRegex));\n\n debug(`f500 reprint field contents (filtered): ${JSON.stringify(filteredF500)}`);\n\n const reprintYears = extractReprintYears(filteredF500);\n\n return reprintYears;\n }\n\n function extractReprintYears(contents) {\n const yearRegex = /[0-9][0-9][0-9][0-9]/gu;\n const years = contents.map(content => content.match(yearRegex))\n .flat();\n debug(`${JSON.stringify(years)}`);\n const uniqYears = [...new Set(years)].sort();\n debug(`${JSON.stringify(uniqYears)}`);\n return uniqYears;\n }\n\n },\n // eslint-disable-next-line max-statements\n compare: (a, b) => {\n const debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features/bib/publication-time-allow-cons-years-multi');\n debug(`Comparing ${JSON.stringify(a)} to ${JSON.stringify(b)}`);\n\n const [firstA] = a.normalYears ? a.normalYears : a;\n const [firstB] = b.normalYears ? b.normalYears : b;\n\n debug(`Comparing ${JSON.stringify(firstA)} to ${JSON.stringify(firstB)}`);\n\n if (firstA === firstB) {\n return 0.1;\n }\n\n // If either of years is a non string/number, values are not comparable\n if (!testStringOrNumber(firstA) || !testStringOrNumber(firstB)) {\n return 0;\n }\n\n const firstANumber = parseInt(firstA, 10);\n const firstBNumber = parseInt(firstB, 10);\n\n // Handle consequent years as a match\n // see publication-time for a version that does not handle consequent years as a match\n if (!(isNaN(firstANumber) || isNaN(firstBNumber)) &&\n (firstANumber + 1 === firstBNumber || firstANumber - 1 === firstBNumber)) {\n return 0.1;\n }\n\n // We should do something with copyrightYears, too\n\n // Do not give minus points if a normal publishing year is found in normal years\n const bNormalInANormal = a.normalYears.filter(aValue => b.normalYears.some(bValue => aValue === bValue));\n const aNormalInBNormal = b.normalYears.filter(bValue => a.normalYears.some(aValue => bValue === aValue));\n debug(`BNorm in ANorm: ${JSON.stringify(bNormalInANormal)}`);\n debug(`ANorm in BNorm: ${JSON.stringify(aNormalInBNormal)}`);\n\n if (bNormalInANormal > 0 || aNormalInBNormal > 0) {\n return 0;\n }\n\n // Do not give minus points if a normal publishing year is found in reprint years\n const bNormalInAReprint = a.reprintYears.filter(aValue => b.normalYears.some(bValue => aValue === bValue));\n const aNormalInBReprint = b.reprintYears.filter(bValue => a.normalYears.some(aValue => bValue === aValue));\n debug(`BNorm in AReprint: ${JSON.stringify(bNormalInAReprint)}`);\n debug(`ANorm in BReprint: ${JSON.stringify(aNormalInBReprint)}`);\n\n if (bNormalInAReprint > 0 || aNormalInBReprint > 0) {\n return 0;\n }\n\n return -1;\n\n }\n});\n\n// https://www.loc.gov/marc/bibliographic/bd008.html\n// field 008\n// 06 - Type of date/Publication status\n// 07-10 - Date 1\n// 11-14 - Date 2\n//\n// 06 - Type of date/Publication status\n// b - No dates given; B.C. date involved\n// c - Continuing resource currently published\n// d - Continuing resource ceased publication\n// e - Detailed date\n// i - Inclusive dates of collection\n// k - Range of years of bulk of collection\n// m - Multiple dates\n// n - Dates unknown\n// p - Date of distribution/release/issue and production/recording session when different\n// q - Questionable date\n// r - Reprint/reissue date and original date\n// s - Single known date/probable date\n// t - Publication date and copyright date\n// u - Continuing resource status unknown\n// | - No attempt to code\n//\n// 07-10 - Date 1\n// 1-9 - Date digit\n// # - Date element is not applicable\n// u - Date element is totally or partially unknown\n// |||| - No attempt to code\n//\n// 11-14 - Date 2\n// 1-9 - Date digit\n// # - Date element is not applicable\n// u - Date element is totally or partially unknown\n// |||| - No attempt to code\n//\n\n"],"mappings":";;;;;;AA4BA;AACA;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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CAAC,IAAIC,iBAAiB,GAAG,CAAC,EAAE;MAClD,OAAO,CAAC;IACV;IAEA,OAAO,CAAC,CAAC;EAEX;AACF,CAAC,CAAC,EAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA"}
1
+ {"version":3,"file":"publication-time-allow-cons-years-multi.js","names":["_matchingUtils","require","_debug","_interopRequireDefault","obj","__esModule","default","_default","name","extract","record","recordExternal","debug","createDebugLogger","label","f008Values","extractF008Values","JSON","stringify","f26xValues","extractF26xValues","f500Values","extractF500Years","normalYears","Set","concat","f008Date1","filter","value","sort","copyrightYears","reprintYears","combined","_record$get","_record$get$","get","undefined","testStringOrNumber","extractF008Date1","f008Date2","extractF008Date2","f008YearType","extractF008YearType","String","slice","copyrightRegex","pubNormalSubFieldValues","extractPubNormalSubfieldValues","pubF264CopySubFieldValues","extractPubF264CopySubfieldValues","pubF260CopySubFieldValues","extractPubF260CopySubfieldValues","field","tag","ind2","map","subfields","flat","code","test","removeNonAlphaNumeric","replace","nonAlphaNumericRegex","reprintRegex","reprintFieldContents","filteredF500","content","match","extractReprintYears","contents","yearRegex","years","uniqYears","compare","a","b","firstA","firstB","firstANumber","parseInt","firstBNumber","isNaN","bNormalInANormal","aValue","some","bValue","aNormalInBNormal","bNormalInAReprint","aNormalInBReprint","exports"],"sources":["../../../../src/match-detection/features/bib/publication-time-allow-cons-years-multi.js"],"sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Melinda record matching modules for Javascript\n*\n* Copyright (C) 2020-2023 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-record-matching-js\n*\n* melinda-record-matching-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-record-matching-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Affero General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nimport {testStringOrNumber} from '../../../matching-utils';\nimport createDebugLogger from 'debug';\n\n// We should also get copyright time and copyright/publication times from 26x\n// We should also get publishing time type from f008\n// We should get reprint times from f500 $a \"Lisäpainos/Lisäpainokset:\"\n\nexport default () => ({\n name: 'Publication time, allow consequent years, years from multiple sources',\n extract: ({record, recordExternal}) => {\n const debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features/bib/publication-time-allow-cons-years-multi');\n const label = recordExternal && recordExternal.label ? recordExternal.label : 'record';\n\n const f008Values = extractF008Values(record);\n debug(`${label} f008: ${JSON.stringify(f008Values)}`);\n\n const f26xValues = extractF26xValues(record);\n debug(`${label} f26x: ${JSON.stringify(f26xValues)}`);\n\n const f500Values = extractF500Years(record);\n debug(`${label} f500: ${JSON.stringify(f500Values)}`);\n\n // We should get copyrightYear from f008Date2 to copyrightYears when f008YearType = 'r'\n // Is the original year (f008Date2) in f008YearType === 'r' comparable to copyrightYear?\n // We should handle unknown years (here or comparison?)\n // We should handle year ranges for continuing resources / collections\n\n const normalYears = [...new Set(f26xValues.normalYears.concat(f008Values.f008Date1).filter(value => value && value !== ' ' && value !== '||||'))].sort();\n const copyrightYears = [...new Set(f26xValues.copyrightYears)].sort();\n const reprintYears = [...new Set(f500Values)].sort();\n\n const combined = {normalYears, copyrightYears, reprintYears};\n\n debug(`Combined: ${JSON.stringify(combined)}`);\n\n return combined;\n\n function extractF008Values(record) {\n // Record should have only one f008 - in case of several, we handle the first one\n const value = record.get(/^008$/u)?.[0]?.value || undefined;\n if (value && testStringOrNumber(value)) {\n const f008Date1 = extractF008Date1(value);\n const f008Date2 = extractF008Date2(value);\n const f008YearType = extractF008YearType(value);\n return {f008Date1, f008Date2, f008YearType};\n }\n return {f008Date1: undefined, f008Date2: undefined, f008YearType: undefined};\n\n function extractF008Date1(value) {\n return String(value).slice(7, 11);\n }\n\n function extractF008Date2(value) {\n return String(value).slice(11, 15);\n }\n\n function extractF008YearType(value) {\n return String(value).slice(6, 7);\n }\n }\n\n function extractF26xValues(record) {\n const copyrightRegex = /^(?<copyrightPrefix>cop|cop.|c|©|p|℗)/u;\n\n const pubNormalSubFieldValues = extractPubNormalSubfieldValues(record, copyrightRegex);\n debug(`Normal years: ${JSON.stringify(pubNormalSubFieldValues)}`);\n\n const pubF264CopySubFieldValues = extractPubF264CopySubfieldValues(record);\n debug(`F264 copyright years: ${JSON.stringify(pubF264CopySubFieldValues)}`);\n\n const pubF260CopySubFieldValues = extractPubF260CopySubfieldValues(record, copyrightRegex);\n debug(`F260 copyright years: ${JSON.stringify(pubF260CopySubFieldValues)}`);\n\n return {normalYears: pubNormalSubFieldValues, copyrightYears: [...pubF260CopySubFieldValues, ...pubF264CopySubFieldValues]};\n\n function extractPubNormalSubfieldValues(record, copyrightRegex) {\n return record.get(/^26[04]$/u)\n .filter((field) => !(field.tag === '264' && field.ind2 === '4'))\n .map(({subfields}) => subfields)\n .flat()\n .filter(({code}) => code && code === 'c')\n .filter(({value}) => value && !copyrightRegex.test(value))\n .map(({value}) => value)\n .map((value) => removeNonAlphaNumeric(value));\n }\n\n function extractPubF264CopySubfieldValues(record, copyrightRegex) {\n return record.get(/^264$/u)\n .filter((field) => field.ind2 === '4')\n .map(({subfields}) => subfields)\n .flat()\n .filter(({code}) => code && code === 'c')\n .filter(({value}) => value)\n .map(({value}) => value)\n .map((value) => value.replace(copyrightRegex, ''))\n .map((value) => removeNonAlphaNumeric(value));\n }\n\n function extractPubF260CopySubfieldValues(record, copyrightRegex) {\n return record.get(/^260$/u)\n .map(({subfields}) => subfields)\n .flat()\n .filter(({code}) => code && code === 'c')\n .filter(({value}) => value && copyrightRegex.test(value))\n .map(({value}) => value)\n .map((value) => value.replace(copyrightRegex, ''))\n .map((value) => removeNonAlphaNumeric(value));\n }\n\n function removeNonAlphaNumeric(value) {\n debug(`Cleaning: ${JSON.stringify(value)}`);\n const nonAlphaNumericRegex = /[^A-Za-z0-9]/ug;\n return value ? value.replace(nonAlphaNumericRegex, '') : value;\n }\n }\n\n function extractF500Years(record) {\n\n const reprintRegex = /(?<reprint>Lisäpainokset:|Lisäpainos:)/u;\n const reprintFieldContents = record.get(/^500$/u)\n .map(({subfields}) => subfields)\n .flat()\n .filter(({code}) => code === 'a')\n .map(({value}) => value);\n //.filter(value => value.test(reprintRegex));\n\n debug(`f500 reprint field contents: ${JSON.stringify(reprintFieldContents)}`);\n\n const filteredF500 = reprintFieldContents.filter((content) => content && content.match(reprintRegex));\n\n debug(`f500 reprint field contents (filtered): ${JSON.stringify(filteredF500)}`);\n\n const reprintYears = extractReprintYears(filteredF500);\n\n return reprintYears;\n }\n\n function extractReprintYears(contents) {\n const yearRegex = /[0-9][0-9][0-9][0-9]/gu;\n const years = contents.map(content => content.match(yearRegex))\n .flat();\n debug(`${JSON.stringify(years)}`);\n const uniqYears = [...new Set(years)].sort();\n debug(`${JSON.stringify(uniqYears)}`);\n return uniqYears;\n }\n\n },\n // eslint-disable-next-line max-statements\n compare: (a, b) => {\n const debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features/bib/publication-time-allow-cons-years-multi');\n debug(`Comparing ${JSON.stringify(a)} to ${JSON.stringify(b)}`);\n\n const [firstA] = a.normalYears ? a.normalYears : a;\n const [firstB] = b.normalYears ? b.normalYears : b;\n\n debug(`Comparing ${JSON.stringify(firstA)} to ${JSON.stringify(firstB)}`);\n\n if (firstA === firstB) {\n return 0.1;\n }\n\n // If either of years is a non string/number, values are not comparable\n if (!testStringOrNumber(firstA) || !testStringOrNumber(firstB)) {\n return 0;\n }\n\n const firstANumber = parseInt(firstA, 10);\n const firstBNumber = parseInt(firstB, 10);\n\n // Handle consequent years as a match\n // see publication-time for a version that does not handle consequent years as a match\n if (!(isNaN(firstANumber) || isNaN(firstBNumber)) &&\n (firstANumber + 1 === firstBNumber || firstANumber - 1 === firstBNumber)) {\n return 0.1;\n }\n\n // We should do something with copyrightYears, too\n\n // Do not give minus points if a normal publishing year is found in normal years\n const bNormalInANormal = a.normalYears.filter(aValue => b.normalYears.some(bValue => aValue === bValue));\n const aNormalInBNormal = b.normalYears.filter(bValue => a.normalYears.some(aValue => bValue === aValue));\n debug(`BNorm in ANorm: ${JSON.stringify(bNormalInANormal)}`);\n debug(`ANorm in BNorm: ${JSON.stringify(aNormalInBNormal)}`);\n\n if (bNormalInANormal > 0 || aNormalInBNormal > 0) {\n return 0;\n }\n\n // Do not give minus points if a normal publishing year is found in reprint years\n const bNormalInAReprint = a.reprintYears.filter(aValue => b.normalYears.some(bValue => aValue === bValue));\n const aNormalInBReprint = b.reprintYears.filter(bValue => a.normalYears.some(aValue => bValue === aValue));\n debug(`BNorm in AReprint: ${JSON.stringify(bNormalInAReprint)}`);\n debug(`ANorm in BReprint: ${JSON.stringify(aNormalInBReprint)}`);\n\n if (bNormalInAReprint > 0 || aNormalInBReprint > 0) {\n return 0;\n }\n\n return -1;\n\n }\n});\n\n// https://www.loc.gov/marc/bibliographic/bd008.html\n// field 008\n// 06 - Type of date/Publication status\n// 07-10 - Date 1\n// 11-14 - Date 2\n//\n// 06 - Type of date/Publication status\n// b - No dates given; B.C. date involved\n// c - Continuing resource currently published\n// d - Continuing resource ceased publication\n// e - Detailed date\n// i - Inclusive dates of collection\n// k - Range of years of bulk of collection\n// m - Multiple dates\n// n - Dates unknown\n// p - Date of distribution/release/issue and production/recording session when different\n// q - Questionable date\n// r - Reprint/reissue date and original date\n// s - Single known date/probable date\n// t - Publication date and copyright date\n// u - Continuing resource status unknown\n// | - No attempt to code\n//\n// 07-10 - Date 1\n// 1-9 - Date digit\n// # - Date element is not applicable\n// u - Date element is totally or partially unknown\n// |||| - No attempt to code\n//\n// 11-14 - Date 2\n// 1-9 - Date digit\n// # - Date element is not applicable\n// u - Date element is totally or partially unknown\n// |||| - No attempt to code\n//\n\n"],"mappings":";;;;;;AA4BA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAsC,SAAAE,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AA7BtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AAAA,IAAAG,QAAA,GAEeA,CAAA,MAAO;EACpBC,IAAI,EAAE,uEAAuE;EAC7EC,OAAO,EAAEA,CAAC;IAACC,MAAM;IAAEC;EAAc,CAAC,KAAK;IACrC,MAAMC,KAAK,GAAG,IAAAC,cAAiB,EAAC,wGAAwG,CAAC;IACzI,MAAMC,KAAK,GAAGH,cAAc,IAAIA,cAAc,CAACG,KAAK,GAAGH,cAAc,CAACG,KAAK,GAAG,QAAQ;IAEtF,MAAMC,UAAU,GAAGC,iBAAiB,CAACN,MAAM,CAAC;IAC5CE,KAAK,CAAE,GAAEE,KAAM,UAASG,IAAI,CAACC,SAAS,CAACH,UAAU,CAAE,EAAC,CAAC;IAErD,MAAMI,UAAU,GAAGC,iBAAiB,CAACV,MAAM,CAAC;IAC5CE,KAAK,CAAE,GAAEE,KAAM,UAASG,IAAI,CAACC,SAAS,CAACC,UAAU,CAAE,EAAC,CAAC;IAErD,MAAME,UAAU,GAAGC,gBAAgB,CAACZ,MAAM,CAAC;IAC3CE,KAAK,CAAE,GAAEE,KAAM,UAASG,IAAI,CAACC,SAAS,CAACG,UAAU,CAAE,EAAC,CAAC;;IAErD;IACA;IACA;IACA;;IAEA,MAAME,WAAW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AAC,IAAII,gBAAgB,GAAG,CAAC,EAAE;MAChD,OAAO,CAAC;IACV;;IAEA;IACA,MAAMC,iBAAiB,GAAGb,CAAC,CAAC3C,YAAY,CAACJ,MAAM,CAACwD,MAAM,IAAIR,CAAC,CAACpD,WAAW,CAAC6D,IAAI,CAACC,MAAM,IAAIF,MAAM,KAAKE,MAAM,CAAC,CAAC;IAC1G,MAAMG,iBAAiB,GAAGb,CAAC,CAAC5C,YAAY,CAACJ,MAAM,CAAC0D,MAAM,IAAIX,CAAC,CAACnD,WAAW,CAAC6D,IAAI,CAACD,MAAM,IAAIE,MAAM,KAAKF,MAAM,CAAC,CAAC;IAC1GvE,KAAK,CAAE,sBAAqBK,IAAI,CAACC,SAAS,CAACqE,iBAAiB,CAAE,EAAC,CAAC;IAChE3E,KAAK,CAAE,sBAAqBK,IAAI,CAACC,SAAS,CAACsE,iBAAiB,CAAE,EAAC,CAAC;IAEhE,IAAID,iBAAiB,GAAG,CAAC,IAAIC,iBAAiB,GAAG,CAAC,EAAE;MAClD,OAAO,CAAC;IACV;IAEA,OAAO,CAAC,CAAC;EAEX;AACF,CAAC,CAAC,EAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAAC,OAAA,CAAAnF,OAAA,GAAAC,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"publication-time-allow-cons-years.js","names":["name","extract","record","value","get","undefined","testStringOrNumber","String","slice","compare","a","b","debug","createDebugLogger","firstA","firstB","firstANumber","parseInt","firstBNumber","isNaN"],"sources":["../../../../src/match-detection/features/bib/publication-time-allow-cons-years.js"],"sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Melinda record matching modules for Javascript\n*\n* Copyright (C) 2020-2023 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-record-matching-js\n*\n* melinda-record-matching-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-record-matching-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Affero General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nimport {testStringOrNumber} from '../../../matching-utils';\nimport createDebugLogger from 'debug';\n\n// We should also get copyright time and copyright/publication times from 26x\n\nexport default () => ({\n name: 'Publication time, allow consequent years',\n extract: ({record}) => {\n const value = record.get(/^008$/u)?.[0]?.value || undefined;\n return testStringOrNumber(value) ? [String(value).slice(7, 11)] : [];\n },\n compare: (a, b) => {\n const debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features/bib/publication-time-allow-cons-years');\n debug(`Comparing ${a[0]} to ${b[0]}`);\n\n const [firstA] = a;\n const [firstB] = b;\n\n if (firstA === firstB) {\n return 0.1;\n }\n\n // If either of years is a non string/number, values are not comparable\n if (!testStringOrNumber(firstA) || !testStringOrNumber(firstB)) {\n return 0;\n }\n\n const firstANumber = parseInt(firstA, 10);\n const firstBNumber = parseInt(firstB, 10);\n\n if (isNaN(firstANumber) || isNaN(firstBNumber)) {\n return -1;\n }\n\n // Handle consequent years as a match\n // see publication-time for a version that does not handle consequent years as a match\n return firstANumber + 1 === firstBNumber || firstANumber - 1 === firstBNumber ? 0.1 : -1;\n }\n});\n"],"mappings":";;;;;;AA4BA;AACA;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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AAC,CAAC;EAC1F;AACF,CAAC,CAAC;AAAA"}
1
+ {"version":3,"file":"publication-time-allow-cons-years.js","names":["_matchingUtils","require","_debug","_interopRequireDefault","obj","__esModule","default","_default","name","extract","record","_record$get","_record$get$","value","get","undefined","testStringOrNumber","String","slice","compare","a","b","debug","createDebugLogger","firstA","firstB","firstANumber","parseInt","firstBNumber","isNaN","exports"],"sources":["../../../../src/match-detection/features/bib/publication-time-allow-cons-years.js"],"sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Melinda record matching modules for Javascript\n*\n* Copyright (C) 2020-2023 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-record-matching-js\n*\n* melinda-record-matching-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-record-matching-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Affero General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nimport {testStringOrNumber} from '../../../matching-utils';\nimport createDebugLogger from 'debug';\n\n// We should also get copyright time and copyright/publication times from 26x\n\nexport default () => ({\n name: 'Publication time, allow consequent years',\n extract: ({record}) => {\n const value = record.get(/^008$/u)?.[0]?.value || undefined;\n return testStringOrNumber(value) ? [String(value).slice(7, 11)] : [];\n },\n compare: (a, b) => {\n const debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features/bib/publication-time-allow-cons-years');\n debug(`Comparing ${a[0]} to ${b[0]}`);\n\n const [firstA] = a;\n const [firstB] = b;\n\n if (firstA === firstB) {\n return 0.1;\n }\n\n // If either of years is a non string/number, values are not comparable\n if (!testStringOrNumber(firstA) || !testStringOrNumber(firstB)) {\n return 0;\n }\n\n const firstANumber = parseInt(firstA, 10);\n const firstBNumber = parseInt(firstB, 10);\n\n if (isNaN(firstANumber) || isNaN(firstBNumber)) {\n return -1;\n }\n\n // Handle consequent years as a match\n // see publication-time for a version that does not handle consequent years as a match\n return firstANumber + 1 === firstBNumber || firstANumber - 1 === firstBNumber ? 0.1 : -1;\n }\n});\n"],"mappings":";;;;;;AA4BA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAsC,SAAAE,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AA7BtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AAAA,IAAAG,QAAA,GAEeA,CAAA,MAAO;EACpBC,IAAI,EAAE,0CAA0C;EAChDC,OAAO,EAAEA,CAAC;IAACC;EAAM,CAAC,KAAK;IAAA,IAAAC,WAAA,EAAAC,YAAA;IACrB,MAAMC,KAAK,GAAG,EAAAF,WAAA,GAAAD,MAAM,CAACI,GAAG,CAAC,QAAQ,CAAC,cAAAH,WAAA,wBAAAC,YAAA,GAApBD,WAAA,CAAuB,CAAC,CAAC,cAAAC,YAAA,uBAAzBA,YAAA,CAA2BC,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,EAAEA,CAACC,CAAC,EAAEC,CAAC,KAAK;IACjB,MAAMC,KAAK,GAAG,IAAAC,cAAiB,EAAC,kGAAkG,CAAC;IACnID,KAAK,CAAE,aAAYF,CAAC,CAAC,CAAC,CAAE,OAAMC,CAAC,CAAC,CAAC,CAAE,EAAC,CAAC;IAErC,MAAM,CAACG,MAAM,CAAC,GAAGJ,CAAC;IAClB,MAAM,CAACK,MAAM,CAAC,GAAGJ,CAAC;IAElB,IAAIG,MAAM,KAAKC,MAAM,EAAE;MACrB,OAAO,GAAG;IACZ;;IAEA;IACA,IAAI,CAAC,IAAAT,iCAAkB,EAACQ,MAAM,CAAC,IAAI,CAAC,IAAAR,iCAAkB,EAACS,MAAM,CAAC,EAAE;MAC9D,OAAO,CAAC;IACV;IAEA,MAAMC,YAAY,GAAGC,QAAQ,CAACH,MAAM,EAAE,EAAE,CAAC;IACzC,MAAMI,YAAY,GAAGD,QAAQ,CAACF,MAAM,EAAE,EAAE,CAAC;IAEzC,IAAII,KAAK,CAACH,YAAY,CAAC,IAAIG,KAAK,CAACD,YAAY,CAAC,EAAE;MAC9C,OAAO,CAAC,CAAC;IACX;;IAEA;IACA;IACA,OAAOF,YAAY,GAAG,CAAC,KAAKE,YAAY,IAAIF,YAAY,GAAG,CAAC,KAAKE,YAAY,GAAG,GAAG,GAAG,CAAC,CAAC;EAC1F;AACF,CAAC,CAAC;AAAAE,OAAA,CAAAxB,OAAA,GAAAC,QAAA"}
@@ -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// see publication-time-allow-cons-years for a version allowing consequent years to match\n\nexport default () => ({\n name: 'Publication time',\n extract: ({record}) => {\n const value = record.get(/^008$/u)?.[0]?.value || undefined;\n return testStringOrNumber(value) ? [String(value).slice(7, 11)] : [];\n },\n compare: (a, b) => a[0] === b[0] ? 0.1 : -1.0\n});\n"],"mappings":";;;;;;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"}
1
+ {"version":3,"file":"publication-time.js","names":["_matchingUtils","require","_default","name","extract","record","_record$get","_record$get$","value","get","undefined","testStringOrNumber","String","slice","compare","a","b","exports","default"],"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// see publication-time-allow-cons-years for a version allowing consequent years to match\n\nexport default () => ({\n name: 'Publication time',\n extract: ({record}) => {\n const value = record.get(/^008$/u)?.[0]?.value || undefined;\n return testStringOrNumber(value) ? [String(value).slice(7, 11)] : [];\n },\n compare: (a, b) => a[0] === b[0] ? 0.1 : -1.0\n});\n"],"mappings":";;;;;;AA4BA,IAAAA,cAAA,GAAAC,OAAA;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,IAAAC,QAAA,GAEeA,CAAA,MAAO;EACpBC,IAAI,EAAE,kBAAkB;EACxBC,OAAO,EAAEA,CAAC;IAACC;EAAM,CAAC,KAAK;IAAA,IAAAC,WAAA,EAAAC,YAAA;IACrB,MAAMC,KAAK,GAAG,EAAAF,WAAA,GAAAD,MAAM,CAACI,GAAG,CAAC,QAAQ,CAAC,cAAAH,WAAA,wBAAAC,YAAA,GAApBD,WAAA,CAAuB,CAAC,CAAC,cAAAC,YAAA,uBAAzBA,YAAA,CAA2BC,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,EAAEA,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAAC,CAAC,CAAC,KAAKC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC;AAC5C,CAAC,CAAC;AAAAC,OAAA,CAAAC,OAAA,GAAAhB,QAAA"}
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"record-type.js","names":["_default","name","extract","record","leader","compare","a","b","exports","default"],"sources":["../../../../src/match-detection/features/bib/record-type.js"],"sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Melinda record matching modules for Javascript\n*\n* Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-record-matching-js\n*\n* melinda-record-matching-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-record-matching-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Affero General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\n// we could handle the case of books/notes\n\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,IAAAA,QAAA,GAEeA,CAAA,MAAO;EACpBC,IAAI,EAAE,aAAa;EACnBC,OAAO,EAAEA,CAAC;IAACC;EAAM,CAAC,KAAKA,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,GAAG,CAACD,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE;EACjEC,OAAO,EAAEA,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAAC,CAAC,CAAC,KAAKC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC;AAC5C,CAAC,CAAC;AAAAC,OAAA,CAAAC,OAAA,GAAAT,QAAA"}