/* Ċ Ġ* ĠCopyright ĠĠ 2 0 2 0 ĠDavid ĠG ĠJ ones Ċ Ġ* Ċ Ġ* ĠLicensed Ġunder Ġthe ĠApache ĠLicense , ĠVersion Ġ 2 . 0 Ġ( the Ġ" License "); Ċ Ġ* Ġyou Ġmay Ġnot Ġuse Ġthis Ġfile Ġexcept Ġin Ġcompliance Ġwith Ġthe ĠLicense . Ċ Ġ* ĠYou Ġmay Ġobtain Ġa Ġcopy Ġof Ġthe ĠLicense Ġat Ċ Ġ* Ċ Ġ* ĠĠĠĠ Ġhttp :// www . apache . org / licenses / LICENSE - 2 . 0 Ċ Ġ* Ċ Ġ* ĠUnless Ġrequired Ġby Ġapplicable Ġlaw Ġor Ġagreed Ġto Ġin Ġwriting , Ġsoftware Ċ Ġ* Ġdistributed Ġunder Ġthe ĠLicense Ġis Ġdistributed Ġon Ġan Ġ" AS ĠIS " ĠBASIS , Ċ Ġ* ĠWITHOUT ĠWARRANTIES ĠOR ĠCONDITIONS ĠOF ĠANY ĠKIND , Ġeither Ġexpress Ġor Ġimplied . Ċ Ġ* ĠSee Ġthe ĠLicense Ġfor Ġthe Ġspecific Ġlanguage Ġgoverning Ġpermissions Ġand Ċ Ġ* Ġlimitations Ġunder Ġthe ĠLicense . Ċ Ġ* Ċ Ġ*/ Ċ Ċ package Ġinfo . dg j ones . bar nable . n arrative Ċ Ċ import Ġinfo . dg j ones . bar nable . domain . general . Human Fields Ċ import Ġinfo . dg j ones . bar nable . qa . Question Processor Ċ import Ġinfo . dg j ones . bar nable . parser . build Text Model Ċ import Ġinfo . dg j ones . bar nable . parser . run Text Process Ċ import Ġorg . junit . jupiter . api . Assertions .* Ċ import Ġorg . junit . jupiter . api . Nested Ċ import Ġorg . junit . jupiter . api . Test Ċ Ċ class ĠQ AT est Ġ{ ĊĠĠĠ Ġval Ġlex icon Ġ= Ġbuild In Depth Under standing Lex icon () ĊĊĠĠĠ Ġ/* ĠFIXME Ġrewrite Ġtest Ġfor Ġnewer ĠQA ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` Question Ġwho Ġgave Ġm ary Ġthe Ġbook Ġ- Ġshared Ġworking Ġmemory `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtext Model Ġ= ĠNa ive Text Model Builder (" John Ġgave ĠM ary Ġa Ġbook "). build Model () ĊĊĠĠĠĠĠĠĠ Ġval Ġtext Processor Ġ= ĠText Processor ( text Model , Ġlex icon ) ĊĠĠĠĠĠĠĠ Ġtext Processor . run Processor () ĊĊĠĠĠĠĠĠĠ Ġ// ĠQuestion Ġ 1 ĊĠĠĠĠĠĠĠ Ġval Ġquestion Model Ġ= ĠNa ive Text Model Builder (" Who Ġgave ĠM ary Ġa Ġbook "). build Model () ĊĠĠĠĠĠĠĠ Ġval Ġresponse Ġ= Ġtext Processor . process Question ( question Model . paragraph s . first (). sentences . first ()) ĊĊĠĠĠĠĠĠĠ ĠAssertions . assertEquals (" John ", Ġresponse ) ĊĊĠĠĠĠĠĠĠ Ġ// ĠQuestion Ġ 2 ĊĠĠĠĠĠĠĠ Ġval Ġquestion Model 2 Ġ= ĠNa ive Text Model Builder (" John Ġgave Ġwho Ġthe Ġbook "). build Model () ĊĠĠĠĠĠĠĠ Ġval Ġresponse 2 Ġ= Ġtext Processor . process Question ( question Model 2 . paragraph s . first (). sentences . first ()) ĊĊĠĠĠĠĠĠĠ ĠAssertions . assertEquals (" M ary ", Ġresponse 2 ) ĊĠĠĠ Ġ} ĊĠĠĠ Ġ*/ ĊĊĠĠĠ Ġ@ Nested ĊĠĠĠ Ġinner Ġclass ĠConcept Completion Test Ġ{ ĊĊĠĠĠĠĠĠĠ Ġ@ Test ĊĠĠĠĠĠĠĠ Ġfun Ġ` Question Ġ- ĠWho Ġdid ĠJohn Ġeat Ġl unch Ġwith `() Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġtext Processor Ġ= Ġrun Text Process (" John Ġhad Ġl unch Ġwith ĠGe orge Ġ. ", Ġlex icon ) ĊĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( 1 , Ġtext Processor . working Memory . concepts . size ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġme al Ġ= Ġtext Processor . working Memory . concepts [ 0 ] ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals (" M op Me al ", Ġme al . name ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals (" John ", Ġme al . value (" e ater A ") ?. value Name ( Human Fields . FirstName )) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals (" Ge orge ", Ġme al . value (" e ater B ") ?. value Name ( Human Fields . FirstName )) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals (" Event E at Me al ", Ġme al . value Name (" event ")) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// ĠQuestion ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġq a Ġ= ĠQuestion Processor ( text Processor ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġresult Ġ= Ġq a . question ( build Text Model (" Who Ġdid ĠJohn Ġhave Ġl unch Ġwith ? ")) ĊĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( 1 , Ġresult . sentence Result . size ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġanswer Concept Ġ= Ġresult . sentence Result [ 0 ] ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals (" John ", Ġanswer Concept . value (" actor ") ?. value Name ( Human Fields . FirstName )) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals (" M op Me al ", Ġanswer Concept . value Name (" act ")) ĊĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals (" Ge orge ", Ġresult . answer ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġ@ Test ĊĠĠĠĠĠĠĠ Ġfun Ġ` Question Ġ- ĠWho Ġ ate Ġl unch `() Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġtext Processor Ġ= Ġrun Text Process (" John Ġhad Ġl unch Ġwith ĠGe orge Ġ. ", Ġlex icon ) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// ĠQuestion ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġq a Ġ= ĠQuestion Processor ( text Processor ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġresult Ġ= Ġq a . question ( build Text Model (" Who Ġ ate Ġl unch ? ")) ĊĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals (" John Ġand ĠGe orge ", Ġresult . answer ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ Ċ }