1/* Copyright 1986-2020 David H. D. Warren, Fernando C. N. Pereira and 2 Jan Wielemaker. 3 4 Permission is hereby granted, free of charge, to any person obtaining a 5 copy of this software and associated documentation files (the 6 "Software"), to deal in the Software without restriction, including 7 without limitation the rights to use, copy, modify, merge, publish, 8 distribute, sublicense, and/or sell copies of the Software, and to 9 permit persons to whom the Software is furnished to do so, subject to 10 the following conditions: 11 12 The above copyright notice and this permission notice shall be included 13 in all copies or substantial portions of the Software. 14 15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 16 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 19 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 20 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 21 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22*/ 23 24:- module(chat80, 25 [ chat_process/2, % +Question, -Answer 26 27 chat_parse/2, % +Question, -Tree 28 chat_semantics/2, % +Tree, -Query 29 chat_optimize/2, % +QueryIn, -Query 30 chat_answer/2, % +Query, -Answer 31 32 chat_example/3, % ?Nr, ?Sentence, ?Correct 33 chat_print_tree/1, % +Tree 34 35 test_chat/0, 36 rtest_chats/1 % +Times 37 ]). 38:- require([ (mode)/1, 39 display/1 40 ]). 41:- ensure_loaded(chat80/chat).
?- chat_process([what, is, the,capital, of, france, ?], A). A = [paris].
68chat_process(Question, Answer) :-
69 process(Question, Answer, _Times).
75chat_parse(Question, Tree) :-
76 sentence(Tree,Question,[],[],[]).
82chat_semantics(Tree, Query) :-
83 i_sentence(Tree,QT),
84 clausify(QT,UE),
85 simplify(UE,Query).
91chat_optimize(QueryIn, Query) :-
92 qplan(QueryIn, Query).
98chat_answer(Query, Answer) :-
99 answer(Query, Answer).
105chat_print_tree(Tree) :-
106 print_tree(Tree).
113chat_example(Nr, Sentence, Correct) :-
114 ed(Nr, Sentence, Correct)
CHAT80 driver for SWI-Prolog
*/