@natlibfi/melinda-record-matching 5.1.4 → 5.1.5-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.
- package/dist/candidate-search/index.js +2 -0
- package/dist/candidate-search/index.js.map +2 -2
- package/dist/candidate-search/query-list/bib.js +16 -3
- package/dist/candidate-search/query-list/bib.js.map +2 -2
- package/dist/match-detection/features/bib/title.js +51 -5
- package/dist/match-detection/features/bib/title.js.map +3 -3
- package/dist/matching-utils.js +39 -0
- package/dist/matching-utils.js.map +2 -2
- package/package.json +9 -11
- package/src/candidate-search/index.js +3 -0
- package/src/candidate-search/query-list/bib.js +24 -4
- package/src/match-detection/features/bib/title.js +62 -7
- package/src/matching-utils.js +50 -0
- package/{src → test}/candidate-search/index.test.js +3 -1
- package/{src → test}/candidate-search/query-list/auth.test.js +1 -1
- package/{src → test}/candidate-search/query-list/bib.test.js +1 -1
- package/{src → test}/index.test.js +10 -5
- package/{src → test}/match-detection/features/auth/index.test.js +1 -1
- package/{src → test}/match-detection/features/bib/index.test.js +1 -1
- package/{src → test}/match-detection/index.test.js +2 -2
- package/dist/candidate-search/index.test.js +0 -89
- package/dist/candidate-search/index.test.js.map +0 -7
- package/dist/candidate-search/query-list/auth.test.js +0 -31
- package/dist/candidate-search/query-list/auth.test.js.map +0 -7
- package/dist/candidate-search/query-list/bib.test.js +0 -31
- package/dist/candidate-search/query-list/bib.test.js.map +0 -7
- package/dist/index.test.js +0 -69
- package/dist/index.test.js.map +0 -7
- package/dist/match-detection/features/auth/index.test.js +0 -37
- package/dist/match-detection/features/auth/index.test.js.map +0 -7
- package/dist/match-detection/features/bib/index.test.js +0 -37
- package/dist/match-detection/features/bib/index.test.js.map +0 -7
- package/dist/match-detection/index.test.js +0 -40
- package/dist/match-detection/index.test.js.map +0 -7
package/dist/index.test.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/index.test.js"],
|
|
4
|
-
"sourcesContent": ["import assert from 'node:assert';\nimport {describe} from 'node:test';\nimport createDebugLogger from 'debug';\nimport {READERS} from '@natlibfi/fixura';\nimport generateTests from '@natlibfi/fixugen-http-client';\nimport {MarcRecord} from '@natlibfi/marc-record';\nimport createMatchInterface, {matchDetection} from './index.js';\n\nconst debug = createDebugLogger('@natlibfi/melinda-record-matching:index:test');\nconst debugData = debug.extend('data');\n\ndescribe('INDEX', () => {\n generateTests({\n callback,\n path: [import.meta.dirname, '..', 'test-fixtures', 'index'],\n recurse: false,\n fixura: {\n reader: READERS.JSON\n }\n });\n\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 assert.equal(matchStatus.status, expectedMatchStatus);\n assert.equal(matchStatus.stopReason, expectedStopReason);\n assert.equal(candidateCount, expectedCandidateCount);\n\n const formattedMatchResult = formatRecordResults(matches);\n assert.deepStrictEqual(formattedMatchResult, expectedMatches);\n\n const formattedNonMatchResult = formatRecordResults(nonMatches);\n assert.deepStrictEqual(formattedNonMatchResult, expectedNonMatches);\n\n if (expectedFailures) {\n assert.deepStrictEqual(conversionFailures, 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"],
|
|
5
|
-
"mappings": "AAAA,OAAO,YAAY;AACnB,SAAQ,gBAAe;AACvB,OAAO,uBAAuB;AAC9B,SAAQ,eAAc;AACtB,OAAO,mBAAmB;AAC1B,SAAQ,kBAAiB;AACzB,OAAO,wBAAuB,sBAAqB;AAEnD,MAAM,QAAQ,kBAAkB,8CAA8C;AAC9E,MAAM,YAAY,MAAM,OAAO,MAAM;AAErC,SAAS,SAAS,MAAM;AACtB,gBAAc;AAAA,IACZ;AAAA,IACA,MAAM,CAAC,YAAY,SAAS,MAAM,iBAAiB,OAAO;AAAA,IAC1D,SAAS;AAAA,IACT,QAAQ;AAAA,MACN,QAAQ,QAAQ;AAAA,IAClB;AAAA,EACF,CAAC;AAED,iBAAe,SAAS,EAAC,YAAY,SAAS,qBAAqB,oBAAoB,kBAAkB,uBAAsB,GAAG;AAEhI,UAAM,SAAS,IAAI,WAAW,WAAW,kBAAkB,GAAG,EAAC,gBAAgB,MAAK,CAAC;AACrF,UAAM,kBAAkB,WAAW,sBAAsB;AACzD,UAAM,qBAAqB,WAAW,yBAAyB,KAAK,CAAC;AAGrE,UAAM,QAAQ,qBAAqB,cAAc,CAAC;AAClD,UAAM,EAAC,SAAS,aAAa,YAAY,oBAAoB,eAAc,IAAI,MAAM,MAAM,EAAC,OAAM,CAAC;AACnG,cAAU,YAAY,QAAQ,MAAM,aAAa,YAAY,MAAM,IAAI,YAAY,UAAU,iBAAiB,aAAa,WAAW,SAAS,cAAc,yBAAyB,qBAAqB,mBAAmB,SAAS,cAAc,EAAE;AAEvP,WAAO,MAAM,YAAY,QAAQ,mBAAmB;AACpD,WAAO,MAAM,YAAY,YAAY,kBAAkB;AACvD,WAAO,MAAM,gBAAgB,sBAAsB;AAEnD,UAAM,uBAAuB,oBAAoB,OAAO;AACxD,WAAO,gBAAgB,sBAAsB,eAAe;AAE5D,UAAM,0BAA0B,oBAAoB,UAAU;AAC9D,WAAO,gBAAgB,yBAAyB,kBAAkB;AAElE,QAAI,kBAAkB;AACpB,aAAO,gBAAgB,oBAAoB,gBAAgB;AAAA,IAC7D;AAEA,aAAS,gBAAgB;AACvB,YAAM,kBAAkB,eAAe,SAAS,QAAQ,UAAU,SAAS,IAAI;AAE/E,aAAO;AAAA,QACL,GAAG;AAAA,QACH,QAAQ;AAAA,UACN,GAAG,QAAQ;AAAA,QACb;AAAA,QACA,WAAW;AAAA,UACT,GAAG,QAAQ;AAAA,UACX,UAAU,QAAQ,UAAU,SAAS,SAAS,IAAI,OAAK,gBAAgB,CAAC,EAAE,CAAC;AAAA,QAC7E;AAAA,MACF;AAAA,IACF;AAEA,aAAS,oBAAoBA,UAAS;AACpC,UAAIA,UAAS;AACX,kBAAU,KAAK,UAAUA,QAAO,CAAC;AACjC,eAAOA,SAAQ,IAAI,CAACC,YAAW;AAAA,UAC7B,GAAGA;AAAA,UACH,WAAW,gBAAgBA,OAAM,SAAS;AAAA,QAC5C,EAAE;AAAA,MACJ;AACA,aAAO,CAAC;AAAA,IACV;AAGA,aAAS,gBAAgB,EAAC,IAAI,QAAAC,QAAM,GAAG;AACrC,YAAM,QAAQ;AACd,YAAM,YAAYA;AAClB,aAAO;AAAA,QACL,IAAI;AAAA,QACJ,QAAQ,UAAU,SAAS;AAAA,MAC7B;AAAA,IACF;AAAA,EACF;AACF,CAAC;",
|
|
6
|
-
"names": ["matches", "match", "record"]
|
|
7
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import assert from "node:assert";
|
|
2
|
-
import { describe } from "node:test";
|
|
3
|
-
import createDebugLogger from "debug";
|
|
4
|
-
import generateTests from "@natlibfi/fixugen";
|
|
5
|
-
import { READERS } from "@natlibfi/fixura";
|
|
6
|
-
import { MarcRecord } from "@natlibfi/marc-record";
|
|
7
|
-
import * as features from "./index.js";
|
|
8
|
-
const debug = createDebugLogger("@natlibfi/melinda-record-matching:match-detection:features/auth:test");
|
|
9
|
-
const debugData = debug.extend("data");
|
|
10
|
-
describe("match-detection/features/auth/", () => {
|
|
11
|
-
generateTests({
|
|
12
|
-
path: [import.meta.dirname, "..", "..", "..", "..", "test-fixtures", "match-detection", "features", "auth"],
|
|
13
|
-
useMetadataFile: true,
|
|
14
|
-
fixura: {
|
|
15
|
-
reader: READERS.JSON
|
|
16
|
-
},
|
|
17
|
-
callback: ({ feature, options, type, ...expectations }) => {
|
|
18
|
-
debug(`Testing: ${feature} ${type}`);
|
|
19
|
-
if (type === "extract") {
|
|
20
|
-
const { expectedFeatures, inputRecord } = expectations;
|
|
21
|
-
const record = new MarcRecord(inputRecord, { subfieldValues: false });
|
|
22
|
-
debugData(`Record: ${record}`);
|
|
23
|
-
const { extract } = features[feature](options);
|
|
24
|
-
assert.deepStrictEqual(extract({ record }), expectedFeatures);
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
if (type === "compare") {
|
|
28
|
-
const { featuresA, featuresB, expectedPoints } = expectations;
|
|
29
|
-
const { compare } = features[feature](options);
|
|
30
|
-
assert.equal(Math.round(compare(featuresA, featuresB) * 100) / 100, expectedPoints);
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
throw new Error(`Invalid type ${type}`);
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
//# sourceMappingURL=index.test.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/match-detection/features/auth/index.test.js"],
|
|
4
|
-
"sourcesContent": ["\nimport assert from 'node:assert';\nimport {describe} from 'node:test';\nimport createDebugLogger from 'debug';\nimport generateTests from '@natlibfi/fixugen';\nimport {READERS} from '@natlibfi/fixura';\nimport {MarcRecord} from '@natlibfi/marc-record';\nimport * as features from './index.js';\n\n\nconst debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features/auth:test');\nconst debugData = debug.extend('data');\n\n\ndescribe('match-detection/features/auth/', () => {\n generateTests({\n path: [import.meta.dirname, '..', '..', '..', '..', 'test-fixtures', 'match-detection', 'features', 'auth'],\n useMetadataFile: true,\n fixura: {\n reader: READERS.JSON\n },\n\n callback: ({feature, options, type, ...expectations}) => {\n debug(`Testing: ${feature} ${type}`);\n\n if (type === 'extract') {\n const {expectedFeatures, inputRecord} = expectations;\n const record = new MarcRecord(inputRecord, {subfieldValues: false});\n debugData(`Record: ${record}`);\n const {extract} = features[feature](options);\n\n assert.deepStrictEqual(extract({record}), expectedFeatures);\n return;\n }\n\n if (type === 'compare') {\n const {featuresA, featuresB, expectedPoints} = expectations;\n const {compare} = features[feature](options);\n\n assert.equal(Math.round(compare(featuresA, featuresB) *100)/100, expectedPoints);\n return;\n }\n\n throw new Error(`Invalid type ${type}`);\n }\n });\n});\n"],
|
|
5
|
-
"mappings": "AACA,OAAO,YAAY;AACnB,SAAQ,gBAAe;AACvB,OAAO,uBAAuB;AAC9B,OAAO,mBAAmB;AAC1B,SAAQ,eAAc;AACtB,SAAQ,kBAAiB;AACzB,YAAY,cAAc;AAG1B,MAAM,QAAQ,kBAAkB,sEAAsE;AACtG,MAAM,YAAY,MAAM,OAAO,MAAM;AAGrC,SAAS,kCAAkC,MAAM;AAC/C,gBAAc;AAAA,IACZ,MAAM,CAAC,YAAY,SAAS,MAAM,MAAM,MAAM,MAAM,iBAAiB,mBAAmB,YAAY,MAAM;AAAA,IAC1G,iBAAiB;AAAA,IACjB,QAAQ;AAAA,MACN,QAAQ,QAAQ;AAAA,IAClB;AAAA,IAEA,UAAU,CAAC,EAAC,SAAS,SAAS,MAAM,GAAG,aAAY,MAAM;AACvD,YAAM,YAAY,OAAO,IAAI,IAAI,EAAE;AAEnC,UAAI,SAAS,WAAW;AACtB,cAAM,EAAC,kBAAkB,YAAW,IAAI;AACxC,cAAM,SAAS,IAAI,WAAW,aAAa,EAAC,gBAAgB,MAAK,CAAC;AAClE,kBAAU,WAAW,MAAM,EAAE;AAC7B,cAAM,EAAC,QAAO,IAAI,SAAS,OAAO,EAAE,OAAO;AAE3C,eAAO,gBAAgB,QAAQ,EAAC,OAAM,CAAC,GAAG,gBAAgB;AAC1D;AAAA,MACF;AAEA,UAAI,SAAS,WAAW;AACtB,cAAM,EAAC,WAAW,WAAW,eAAc,IAAI;AAC/C,cAAM,EAAC,QAAO,IAAI,SAAS,OAAO,EAAE,OAAO;AAE3C,eAAO,MAAM,KAAK,MAAM,QAAQ,WAAW,SAAS,IAAG,GAAG,IAAE,KAAK,cAAc;AAC/E;AAAA,MACF;AAEA,YAAM,IAAI,MAAM,gBAAgB,IAAI,EAAE;AAAA,IACxC;AAAA,EACF,CAAC;AACH,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import assert from "node:assert";
|
|
2
|
-
import { describe } from "node:test";
|
|
3
|
-
import createDebugLogger from "debug";
|
|
4
|
-
import generateTests from "@natlibfi/fixugen";
|
|
5
|
-
import { READERS } from "@natlibfi/fixura";
|
|
6
|
-
import { MarcRecord } from "@natlibfi/marc-record";
|
|
7
|
-
import * as features from "./index.js";
|
|
8
|
-
const debug = createDebugLogger("@natlibfi/melinda-record-matching:match-detection:features/bib:test");
|
|
9
|
-
const debugData = debug.extend("data");
|
|
10
|
-
describe("match-detection/features/bib/", () => {
|
|
11
|
-
generateTests({
|
|
12
|
-
path: [import.meta.dirname, "..", "..", "..", "..", "test-fixtures", "match-detection", "features", "bib"],
|
|
13
|
-
useMetadataFile: true,
|
|
14
|
-
fixura: {
|
|
15
|
-
reader: READERS.JSON
|
|
16
|
-
},
|
|
17
|
-
callback: ({ feature, options, type, ...expectations }) => {
|
|
18
|
-
debug(`Testing: ${feature} ${type}`);
|
|
19
|
-
if (type === "extract") {
|
|
20
|
-
const { expectedFeatures, inputRecord } = expectations;
|
|
21
|
-
const record = new MarcRecord(inputRecord, { subfieldValues: false });
|
|
22
|
-
debugData(`Record: ${record}`);
|
|
23
|
-
const { extract } = features[feature](options);
|
|
24
|
-
assert.deepStrictEqual(extract({ record }), expectedFeatures);
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
if (type === "compare") {
|
|
28
|
-
const { featuresA, featuresB, expectedPoints } = expectations;
|
|
29
|
-
const { compare } = features[feature](options);
|
|
30
|
-
assert.equal(Math.round(compare(featuresA, featuresB) * 100) / 100, expectedPoints);
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
throw new Error(`Invalid type ${type}`);
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
//# sourceMappingURL=index.test.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/match-detection/features/bib/index.test.js"],
|
|
4
|
-
"sourcesContent": ["\nimport assert from 'node:assert';\nimport {describe} from 'node:test';\nimport createDebugLogger from 'debug';\nimport generateTests from '@natlibfi/fixugen';\nimport {READERS} from '@natlibfi/fixura';\nimport {MarcRecord} from '@natlibfi/marc-record';\nimport * as features from './index.js';\n\n\nconst debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:features/bib:test');\nconst debugData = debug.extend('data');\n\n\ndescribe('match-detection/features/bib/', () => {\n generateTests({\n path: [import.meta.dirname, '..', '..', '..', '..', 'test-fixtures', 'match-detection', 'features', 'bib'],\n useMetadataFile: true,\n fixura: {\n reader: READERS.JSON\n },\n\n callback: ({feature, options, type, ...expectations}) => {\n debug(`Testing: ${feature} ${type}`);\n\n if (type === 'extract') {\n const {expectedFeatures, inputRecord} = expectations;\n const record = new MarcRecord(inputRecord, {subfieldValues: false});\n debugData(`Record: ${record}`);\n const {extract} = features[feature](options);\n\n assert.deepStrictEqual(extract({record}), expectedFeatures);\n return;\n }\n\n if (type === 'compare') {\n const {featuresA, featuresB, expectedPoints} = expectations;\n const {compare} = features[feature](options);\n\n assert.equal(Math.round(compare(featuresA, featuresB) *100)/100, expectedPoints);\n return;\n }\n\n throw new Error(`Invalid type ${type}`);\n }\n });\n});\n"],
|
|
5
|
-
"mappings": "AACA,OAAO,YAAY;AACnB,SAAQ,gBAAe;AACvB,OAAO,uBAAuB;AAC9B,OAAO,mBAAmB;AAC1B,SAAQ,eAAc;AACtB,SAAQ,kBAAiB;AACzB,YAAY,cAAc;AAG1B,MAAM,QAAQ,kBAAkB,qEAAqE;AACrG,MAAM,YAAY,MAAM,OAAO,MAAM;AAGrC,SAAS,iCAAiC,MAAM;AAC9C,gBAAc;AAAA,IACZ,MAAM,CAAC,YAAY,SAAS,MAAM,MAAM,MAAM,MAAM,iBAAiB,mBAAmB,YAAY,KAAK;AAAA,IACzG,iBAAiB;AAAA,IACjB,QAAQ;AAAA,MACN,QAAQ,QAAQ;AAAA,IAClB;AAAA,IAEA,UAAU,CAAC,EAAC,SAAS,SAAS,MAAM,GAAG,aAAY,MAAM;AACvD,YAAM,YAAY,OAAO,IAAI,IAAI,EAAE;AAEnC,UAAI,SAAS,WAAW;AACtB,cAAM,EAAC,kBAAkB,YAAW,IAAI;AACxC,cAAM,SAAS,IAAI,WAAW,aAAa,EAAC,gBAAgB,MAAK,CAAC;AAClE,kBAAU,WAAW,MAAM,EAAE;AAC7B,cAAM,EAAC,QAAO,IAAI,SAAS,OAAO,EAAE,OAAO;AAE3C,eAAO,gBAAgB,QAAQ,EAAC,OAAM,CAAC,GAAG,gBAAgB;AAC1D;AAAA,MACF;AAEA,UAAI,SAAS,WAAW;AACtB,cAAM,EAAC,WAAW,WAAW,eAAc,IAAI;AAC/C,cAAM,EAAC,QAAO,IAAI,SAAS,OAAO,EAAE,OAAO;AAE3C,eAAO,MAAM,KAAK,MAAM,QAAQ,WAAW,SAAS,IAAG,GAAG,IAAE,KAAK,cAAc;AAC/E;AAAA,MACF;AAEA,YAAM,IAAI,MAAM,gBAAgB,IAAI,EAAE;AAAA,IACxC;AAAA,EACF,CAAC;AACH,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import assert from "node:assert";
|
|
2
|
-
import { describe } from "node:test";
|
|
3
|
-
import createDebugLogger from "debug";
|
|
4
|
-
import { inspect } from "util";
|
|
5
|
-
import generateTests from "@natlibfi/fixugen";
|
|
6
|
-
import { READERS } from "@natlibfi/fixura";
|
|
7
|
-
import { MarcRecord } from "@natlibfi/marc-record";
|
|
8
|
-
import createDetectionInterface from "./index.js";
|
|
9
|
-
import * as features from "./features/index.js";
|
|
10
|
-
const debug = createDebugLogger("@natlibfi/melinda-record-matching:match-detection:test");
|
|
11
|
-
const debugData = debug.extend("data");
|
|
12
|
-
describe("match-detection", () => {
|
|
13
|
-
generateTests({
|
|
14
|
-
path: [import.meta.dirname, "..", "..", "test-fixtures", "match-detection", "index"],
|
|
15
|
-
useMetadataFile: true,
|
|
16
|
-
recurse: false,
|
|
17
|
-
fixura: {
|
|
18
|
-
reader: READERS.JSON
|
|
19
|
-
},
|
|
20
|
-
callback: ({ getFixture, options, expectedResults, array }) => {
|
|
21
|
-
const detect = createDetectionInterface(formatOptions());
|
|
22
|
-
const recordA = new MarcRecord(getFixture("recordA.json"), { subfieldValues: false });
|
|
23
|
-
debugData(inspect(recordA));
|
|
24
|
-
debug(`Our recordB is an array of records: ${array}`);
|
|
25
|
-
const recordB = array ? getFixture("recordB.json").map((recordJson) => new MarcRecord(recordJson, { subfieldValues: false })) : new MarcRecord(getFixture("recordB.json"), { subfieldValues: false });
|
|
26
|
-
debugData(inspect(recordB));
|
|
27
|
-
const results = detect({ recordA, recordB });
|
|
28
|
-
debugData(`${JSON.stringify(results)}`);
|
|
29
|
-
assert.deepStrictEqual(results, expectedResults);
|
|
30
|
-
function formatOptions() {
|
|
31
|
-
const contextFeatures = features[options.strategy.type];
|
|
32
|
-
return {
|
|
33
|
-
...options,
|
|
34
|
-
strategy: options.strategy.features.map((v) => contextFeatures[v]())
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
//# sourceMappingURL=index.test.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/match-detection/index.test.js"],
|
|
4
|
-
"sourcesContent": ["import assert from 'node:assert';\nimport {describe} from 'node:test';\nimport createDebugLogger from 'debug';\nimport {inspect} from 'util';\nimport generateTests from '@natlibfi/fixugen';\nimport {READERS} from '@natlibfi/fixura';\nimport {MarcRecord} from '@natlibfi/marc-record';\n\nimport createDetectionInterface from './index.js';\nimport * as features from './features/index.js';\n\nconst debug = createDebugLogger('@natlibfi/melinda-record-matching:match-detection:test');\nconst debugData = debug.extend('data');\n\ndescribe('match-detection', () => {\n generateTests({\n path: [import.meta.dirname, '..', '..', 'test-fixtures', 'match-detection', 'index'],\n useMetadataFile: true,\n recurse: false,\n fixura: {\n reader: READERS.JSON\n },\n callback: ({getFixture, options, expectedResults, array}) => {\n const detect = createDetectionInterface(formatOptions());\n const recordA = new MarcRecord(getFixture('recordA.json'), {subfieldValues: false});\n debugData(inspect(recordA));\n\n debug(`Our recordB is an array of records: ${array}`);\n const recordB = array\n ? getFixture('recordB.json').map(recordJson => new MarcRecord(recordJson, {subfieldValues: false}))\n : new MarcRecord(getFixture('recordB.json'), {subfieldValues: false});\n debugData(inspect(recordB));\n\n const results = detect({recordA, recordB});\n debugData(`${JSON.stringify(results)}`);\n\n assert.deepStrictEqual(results, expectedResults);\n\n function formatOptions() {\n const contextFeatures = features[options.strategy.type];\n\n return {\n ...options,\n strategy: options.strategy.features.map(v => contextFeatures[v]())\n };\n }\n }\n });\n});\n"],
|
|
5
|
-
"mappings": "AAAA,OAAO,YAAY;AACnB,SAAQ,gBAAe;AACvB,OAAO,uBAAuB;AAC9B,SAAQ,eAAc;AACtB,OAAO,mBAAmB;AAC1B,SAAQ,eAAc;AACtB,SAAQ,kBAAiB;AAEzB,OAAO,8BAA8B;AACrC,YAAY,cAAc;AAE1B,MAAM,QAAQ,kBAAkB,wDAAwD;AACxF,MAAM,YAAY,MAAM,OAAO,MAAM;AAErC,SAAS,mBAAmB,MAAM;AAChC,gBAAc;AAAA,IACZ,MAAM,CAAC,YAAY,SAAS,MAAM,MAAM,iBAAiB,mBAAmB,OAAO;AAAA,IACnF,iBAAiB;AAAA,IACjB,SAAS;AAAA,IACT,QAAQ;AAAA,MACN,QAAQ,QAAQ;AAAA,IAClB;AAAA,IACA,UAAU,CAAC,EAAC,YAAY,SAAS,iBAAiB,MAAK,MAAM;AAC3D,YAAM,SAAS,yBAAyB,cAAc,CAAC;AACvD,YAAM,UAAU,IAAI,WAAW,WAAW,cAAc,GAAG,EAAC,gBAAgB,MAAK,CAAC;AAClF,gBAAU,QAAQ,OAAO,CAAC;AAE1B,YAAM,uCAAuC,KAAK,EAAE;AACpD,YAAM,UAAU,QACZ,WAAW,cAAc,EAAE,IAAI,gBAAc,IAAI,WAAW,YAAY,EAAC,gBAAgB,MAAK,CAAC,CAAC,IAChG,IAAI,WAAW,WAAW,cAAc,GAAG,EAAC,gBAAgB,MAAK,CAAC;AACtE,gBAAU,QAAQ,OAAO,CAAC;AAE1B,YAAM,UAAU,OAAO,EAAC,SAAS,QAAO,CAAC;AACzC,gBAAU,GAAG,KAAK,UAAU,OAAO,CAAC,EAAE;AAEtC,aAAO,gBAAgB,SAAS,eAAe;AAE/C,eAAS,gBAAgB;AACvB,cAAM,kBAAkB,SAAS,QAAQ,SAAS,IAAI;AAEtD,eAAO;AAAA,UACL,GAAG;AAAA,UACH,UAAU,QAAQ,SAAS,SAAS,IAAI,OAAK,gBAAgB,CAAC,EAAE,CAAC;AAAA,QACnE;AAAA,MACF;AAAA,IACF;AAAA,EACF,CAAC;AACH,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|