Does it work on your machines? I don't know how to use it- i get errors every time. Tell me please how to use it....
Link to source: http://ai-programming.com/prolog_bot_tutorial.htm
Code:
% Program Name: chatterbot1
% Description: this is a very basic example of a chatterbot program
%
% Author: Gonzales Cenelia
% Date: 7 august 2009
%
response_database([
['I HEARD YOU!'],
['SO, YOU ARE TALKING TO ME.'],
['CONTINUE, IM LISTENING.'],
['VERY INTERESTING CONVERSATION.'],
['TELL ME MORE...']]).
select(0, [H|T], H).
select(N, [H|T], L) :- N > 0, N1 is N - 1, select(N1, T, L).
quit_session(X):- X = 'bye',
nl, write('IT WAS NICE TALKING TO YOU USER, SEE YOU NEXT TIME!').
write_string([H|T]):- write(H).
chatterbot1:-
repeat,
nl, write('>'),
read_string(Input),
response_database(ListOfResponse),
IndexOfResponse is integer(random * 5),
select(IndexOfResponse, ListOfResponse, Response),
write_string(Response),
quit_session(Input).
I have tried some ways to write, maybe i dont know how correctly do it thats errors:
1 ?- hi.
ERROR: toplevel: Undefined procedure: hi/0 (DWIM could not correct goal)
2 ?- [hi].
ERROR: source_sink `hi' does not exist true.
3 ?- 'hi'.
ERROR: toplevel: Undefined procedure: hi/0 (DWIM could not correct goal)
4 ?- ['hi'].
ERROR: source_sink `hi' does not exist true.