;This program is a very simple version of Alice ; when a answer to a question is not in the database this program ;will try to find an alternative answer that matches closely to the question asked (require "database.lsp") (require "parse.lsp") (require "find_question.lsp") (require "link_item_to_color.lsp") (require "alternate_ans.lsp") (defvar *parsed_list*) (defvar *ans_list*) (defvar *item_color_ans_list*) (defvar *saved_parsed_list*) (defun main(user_question) ;loads the database into memory (data) (setq parsed_list (list )) (setq saved_parsed_list (list )) (setq ans_list (list )) (setq item_color_ans_list (list )) ;parses the user question (parse_user_question user_question) (setq saved_parsed_list parsed_list) ;locates question pattern in user question (find_ques parsed_list) ;establishes link between item and color (find_item_color parsed_list) ;if exact answer not found, finds the closest answer (if (null item_color_ans_list) (find_alt_ans parsed_list) ) ;finds and displays the answer (setq answer (assoc item_color_ans_list ans_list)) (format t "~%") (print answer) (format t "~%") (print 'End) (format t "~%") )