poole@CPSC-M-POOLE01 prolog % swipl Welcome to SWI-Prolog (threaded, 64 bits, version 9.0.4) SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software. Please run ?- license. for legal details. For online help and background, visit https://www.swi-prolog.org For built-in help, use ?- help(Topic). or ?- apropos(Word). ?- [geography_QA]. true. ?- q(Ans). Ask me: What is next to Chile? Ans = argentina ; Ans = peru ; No more answers Ask me: What is the name of the capital of a Spanish speaking country that borders Argentina? Ans = "Santiago" ; Ans = "Asunción" ; No more answers Ask me: q false. ?- q(Ans). Ask me: What is a Portugese-speaking country bordering Peru? Ans = brazil . ?- What is a Portugese-speaking country bordering Brazil? | | ^C Action (h for help) ? abort | poole@CPSC-M-POOLE01 prolog % swipl Welcome to SWI-Prolog (threaded, 64 bits, version 9.0.4) SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software. Please run ?- license. for legal details. For online help and background, visit https://www.swi-prolog.org For built-in help, use ?- help(Topic). or ?- apropos(Word). ?- [geography_QA]. true. ?- q(Ans). Ask me: What is a Portugese-speaking country bordering Brazil? No more answers Ask me: What biof sifj gjs jdjfjf and other nonsense No more answers Ask me: What country bordering Brazil borders Peru? Ans = argentina ; Ans = paraguay ; Ans = peru ; No more answers Ask me: q false. ?- ^D % halt poole@CPSC-M-POOLE01 prolog % swipl Welcome to SWI-Prolog (threaded, 64 bits, version 9.0.4) SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software. Please run ?- license. for legal details. For online help and background, visit https://www.swi-prolog.org For built-in help, use ?- help(Topic). or ?- apropos(Word). ?- [geography_QA]. true. ?- q(Ans). No more answers Ask me: What country bordering Brazil borders Peru? No more answers Ask me: q false. ?- ^D % halt poole@CPSC-M-POOLE01 prolog % swipl Welcome to SWI-Prolog (threaded, 64 bits, version 9.0.4) SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software. Please run ?- license. for legal details. For online help and background, visit https://www.swi-prolog.org For built-in help, use ?- help(Topic). or ?- apropos(Word). ?- [geography_QA_query]. true. ?- noun_phrase(["a", "Spanish", "speaking", "country"],L1,E1,C0,C1). L1 = [], C0 = [language(E1, _A), name(_A, "Spanish"), country(E1)|C1] . ?- language(E1, _A), name(_A, "Spanish"), country(E1). E1 = argentina, _A = spanish ; E1 = chile, _A = spanish ; E1 = paraguay, _A = spanish ; E1 = peru, _A = spanish. ?- noun_phrase(["a", "country", "bordering", "Chile"],[],E1,C0,[]). C0 = [country(E1), borders(E1, chile)] ; false. ?- country(E1), borders(E1, chile). E1 = argentina ; E1 = peru ; false. ?- noun_phrase(["a", "country", "bordering", "Chile"],[],E1,C0,[]), prove_all(C0). E1 = argentina, C0 = [country(argentina), borders(argentina, chile)] ; E1 = peru, C0 = [country(peru), borders(peru, chile)] ; false. ?- call(country(X)). X = argentina ; X = brazil . ?- country(X). X = argentina ; X = brazil . ?- noun_phrase(["large", "country", "bordering", "Paraguay", "borders", "Chile"], L, A,C0,C1). L = [], C0 = [large(A), country(A), borders(A, paraguay), borders(paraguay, chile)|C1] ; L = ["borders", "Chile"], C0 = [large(A), country(A), borders(A, paraguay)|C1] ; L = ["bordering", "Paraguay", "borders", "Chile"], C0 = [large(A), country(A)|C1] ; false. ?- ^D % halt poole@CPSC-M-POOLE01 prolog % swipl Welcome to SWI-Prolog (threaded, 64 bits, version 9.0.4) SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software. Please run ?- license. for legal details. For online help and background, visit https://www.swi-prolog.org For built-in help, use ?- help(Topic). or ?- apropos(Word). ?- [geography_QA_query]. true. ?- noun_phrase(["large", "country", "bordering", "Paraguay", "borders", "Chile"], L, A,C0,C1). L = ["borders", "Chile"], C0 = [large(A), country(A), borders(A, paraguay)|C1] ; L = ["bordering", "Paraguay", "borders", "Chile"], C0 = [large(A), country(A)|C1] ; false. ?- q(Ans). No more answers What large country bordering Paraguay borders Chile? Ans = argentina ; No more answers Ask me: