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).

CHAT80 driver for SWI-Prolog

*/

 test_chat
Run default demo suite, showing timing and warn if the answer is incorrect.
 rtest_chats(+Times)
Run the test suite Times times silently. Used for timing and profiling.
 chat_process(+Question, -Answer)
Process Question using chat80, resulting in Answer. Question is a list of atoms expressing words. For exampple,
?- chat_process([what, is, the,capital, of, france, ?], A).
A = [paris].
See also
- tokenize_atom/2.
   68chat_process(Question, Answer) :-
   69    process(Question, Answer, _Times).
 chat_parse(+Question, -Tree)
Perform the parsing phase of CHAT80.
   75chat_parse(Question, Tree) :-
   76    sentence(Tree,Question,[],[],[]).
 chat_semantics(+Tree, -Query)
Translate the NLP parse tree into a Prolog query.
   82chat_semantics(Tree, Query) :-
   83    i_sentence(Tree,QT),
   84    clausify(QT,UE),
   85    simplify(UE,Query).
 chat_optimize(+QueryIn, -Query)
Optimize a query
   91chat_optimize(QueryIn, Query) :-
   92    qplan(QueryIn, Query).
 chat_answer(+Query, -Answer)
Find answers for the Query.
   98chat_answer(Query, Answer) :-
   99    answer(Query, Answer).
 chat_print_tree(+Tree)
Print an NLP parse tree
  105chat_print_tree(Tree) :-
  106    print_tree(Tree).
 chat_example(?Nr, ?Sentence, ?Correct)
True when Nr is the (integer) id of the tokenized Sentence and Correct is the correct answer.
  113chat_example(Nr, Sentence, Correct) :-
  114    ed(Nr, Sentence, Correct)