Recognize National Library patent evidence
This commit is contained in:
@@ -257,10 +257,15 @@ suite('normalized level persistence API', () => {
|
||||
}),goals:[expect.objectContaining({
|
||||
key:'barricelli.inventor-proof',status:'pending',newlyCompleted:false,
|
||||
})] })
|
||||
expect(await (await adminFetch(`${baseUrl}/api/levels/${imported.playableLevel.id}/evidence-match-rules`)).json()).toEqual([
|
||||
const sceneSevenRules=await (await adminFetch(`${baseUrl}/api/levels/${imported.playableLevel.id}/evidence-match-rules`)).json()
|
||||
expect(sceneSevenRules).toHaveLength(2)
|
||||
expect(sceneSevenRules).toEqual(expect.arrayContaining([
|
||||
expect.objectContaining({ name:'Google Patents · GB695913A',sourceUri:'https://patents.google.com/patent/GB695913A/en',
|
||||
flagKey:'scene7.nils_inventor_proved',minimumAnchorMatches:2 }),
|
||||
])
|
||||
expect.objectContaining({ name:'Nasjonalbiblioteket · Patent 93585',
|
||||
sourceUri:'https://www.nb.no/items/921545b51acef0b05054cfc1f4666975?page=9&searchText=baricelli',
|
||||
flagKey:'scene7.nils_inventor_proved',minimumAnchorMatches:2 }),
|
||||
]))
|
||||
expect(await (await adminFetch(`${baseUrl}/api/levels/${imported.playableLevel.id}/evidence-semantic-rules`)).json()).toEqual([
|
||||
expect.objectContaining({ goalKey:'barricelli.inventor-proof',targetSubject:'Nils Aall Barricelli',
|
||||
relatedFlagKey:'scene7.father_inventor_discovered' }),
|
||||
|
||||
@@ -30,9 +30,12 @@ const sceneSevenManifest = JSON.parse(readFileSync(
|
||||
goals: { key:string;requiredFlags:string[] }[]
|
||||
evidenceMatchRules: { name:string;flagKey:string;minimumAnchorMatches:number;anchors:{ phrase:string;minimumSimilarity:number }[] }[]
|
||||
}
|
||||
const authoredPatentRule = sceneSevenManifest.evidenceMatchRules[0]
|
||||
const patentRule = { id:'rule-patent',...authoredPatentRule,
|
||||
anchors:authoredPatentRule.anchors.map((anchor,index) => ({ id:`anchor-${index}`,...anchor })) }
|
||||
const authoredPatentRule = sceneSevenManifest.evidenceMatchRules.find(rule => rule.name.startsWith('Google Patents'))!
|
||||
const authoredNationalLibraryRule = sceneSevenManifest.evidenceMatchRules.find(rule => rule.name.startsWith('Nasjonalbiblioteket'))!
|
||||
const materializeRule = (id:string, rule:typeof authoredPatentRule) => ({ id,...rule,
|
||||
anchors:rule.anchors.map((anchor,index) => ({ id:`${id}-anchor-${index}`,...anchor })) })
|
||||
const patentRule = materializeRule('rule-patent',authoredPatentRule)
|
||||
const nationalLibraryRule = materializeRule('rule-national-library',authoredNationalLibraryRule)
|
||||
|
||||
describe('evidence text matching', () => {
|
||||
it('normalizes historical Norwegian characters and page layout noise', () => {
|
||||
@@ -69,6 +72,12 @@ describe('evidence text matching', () => {
|
||||
expect(evaluation.matchedAnchorCount).toBeGreaterThanOrEqual(2)
|
||||
})
|
||||
|
||||
it('accepts the Norwegian National Library patent notice found during playtesting', () => {
|
||||
const evaluation = evaluateEvidenceRules(sceneSevenFixture('national-library-patent-ocr.txt'), [nationalLibraryRule])[0]
|
||||
expect(evaluation).toMatchObject({ matched:true,flagKey:'scene7.nils_inventor_proved' })
|
||||
expect(evaluation.matchedAnchorCount).toBeGreaterThanOrEqual(2)
|
||||
})
|
||||
|
||||
it('keeps the Scene 7 assignment empty and ties its goal to the source flag', () => {
|
||||
expect(sceneSevenManifest.documents).toEqual([])
|
||||
expect(sceneSevenManifest.goals).toEqual([
|
||||
@@ -78,8 +87,8 @@ describe('evidence text matching', () => {
|
||||
})
|
||||
|
||||
it('does not confuse the father-only source with proof about Nils', () => {
|
||||
expect(evaluateEvidenceRules(sceneSevenFixture('father-only-negative-ocr.txt'), [patentRule])[0])
|
||||
.toMatchObject({ matched: false })
|
||||
expect(evaluateEvidenceRules(sceneSevenFixture('father-only-negative-ocr.txt'), [patentRule,nationalLibraryRule]))
|
||||
.toEqual([expect.objectContaining({ matched:false }),expect.objectContaining({ matched:false })])
|
||||
})
|
||||
|
||||
it('tolerates a cropped, line-broken patent result without accepting unrelated patents or empty OCR', () => {
|
||||
|
||||
Reference in New Issue
Block a user