--- Begin Message ---
here is where i am sofar after adding addline....now
somethings dont work and the databaase wont update
mydatabase.p ;;; shows ------->
lvars database;
[] -> database;
.....................................the following
errors when i run converse();
...............i wan the program to make a list of
what is not currently in the database... if it is in
the database it shouyld not add it but pattern match
what is already there
Setpop
: load 'mybot.p'
;;; LOADING mybot.p
;;; LOADING mydatabase.p
;;; MISHAP - msep: MISSING SEPARATOR (eg semicolon)
;;; INVOLVING: ] [
;;; FILE : c:\program
files\poplog\15.5\mydatabase.p LINE NUMBER:
;;; 2
;;; DOING : loadcompiler loadcompiler
pop_setpop_compiler runproc runproc
;;;
Setpop
: load 'mybot.p'
;;; LOADING mybot.p
;;; LOADING mydatabase.p
;;; DECLARING VARIABLE verify
;;; DECLARING VARIABLE line
: converse();
** [hello]
** [what is your name ?]
? doc
** [pleased to meet you doc]
** [well - what do you want to talk about ?]
? how are you?
;;; MISHAP - ATTEMPT TO ADD UNDER SPECIFIED ITEM
;;; INVOLVING: [how are you ?]
;;; DOING : add converse pop_setpop_compiler
runproc runproc
.......................................................
: load 'mybot.p'
;;; LOADING mybot.p
;;; LOADING mydatabase.p
: converse();
** [hello]
** [what is your name ?]
? doc
** [pleased to meet you doc]
** [well - what do you want to talk about ?]
? hi
;;; MISHAP - LIST NEEDED
;;; INVOLVING: <undef meaning>
;;; DOING : answer converse pop_setpop_compiler
runproc runproc
...............................................
[] -> database;
load 'mydatabase.p';
define converse();
vars list,answer,name;
[hello] =>
[what is your name?] =>
readline() -> name;
[pleased to meet you ^^name] =>
[well - what do you want to talk about?] =>
repeat forever
lvars line;
readline() -> line;
quitif(line = [bye]);
add(line);
answer(list) =>
endrepeat;
[goodbye ^^name - talk to you another time.] =>
storedata('mydatabase.p');
enddefine;
;;; check the facts (word [thing] - meaning) in the
database. if not there(add it)
define interpret(list) -> response;
vars thing,whatis,meaning;
if list matches [^thing is ??meaning] then
verify(thing, meaning) -> response;
elseif list matches [what is ??thing] then
whatis(thing) -> response;
else [please inform me ^name] ->response;
endif;
enddefine;
define whatis(thing) -> response;
vars info;
if present([^thing ??info]) then
[^thing ^^info] -> response;
elseif present([^thing ??info]) then
[a ^thing is a ^^info] -> response;
else[i dont know what that is.] -> response;
endif;
enddefine;
define verify(thing, meaning) -> response;
vars verify,info;
if present([^thing ^^meaning]) then
[i am aware of that] -> response;
elseif present([^thing ??info]) then
[that ^^info] -> response;
else add([^thing is ^^meaning]);
[i have made a note of that.] -> response;
endif;
enddefine;
define forget(list) -> response;
vars thing,meaning;
remove([^thing is ^^meaning]);
[i have removed that info from my knowledge base.] ->
response;
enddefine;
define answer(list) -> response;
vars response;
if list matches [bye] then [bye - i will talk to you
again sometime.]
elseif list matches [hello ==] then
[hello, how are you?] -> response;
elseif list matches [what are you?] then [i am a
chatbot. i converse in a limited syntax of natural
language.] -> response;
elseif list matches [thank ==] then [you are
welcome...] -> response;
elseif list matches [thanks] then [dont mention it.]
-> response;
elseif list matches [how are you ==] then [i am fine.
and you?] -> response;
elseif list matches [is your name dile?] then [yes.]
-> response;
elseif list matches [is your name ==] then [my name is
dile.] -> response;
elseif list matches [do you like ==] then [i am not
programmed to like or dislike ^^name.] -> response;
elseif list matches [i want == ] then [ok...] ->
response;
elseif list matches [what == my name ==] then [your
name is ^^name.] -> response;
elseif list matches [== fine ==] then [that is fine.]
-> response;
elseif list matches [what is your name ==] then [my
name is dile.] -> response;
elseif list matches [who are you?] then [i am dile.]
-> response;
elseif list matches [who are you] then [i am dile.] ->
response;
elseif list matches [who am i?] then [you are ^^name.]
-> response;
elseif list matches [who am i] then [you are ^^name.]
-> response;
elseif list matches [show == database] then database
-> response; ;;;==> -> response;
elseif list matches [what is ^thing] then [^thing is
^^meaning.] -> response;
elseif list matches [forget ^thing is ^^meaning] then
[deleting from my database] -> response;
elseif list matches [==] then add(line); [i will make
a note of that] -> response;
else [i dont understand.] -> response;
endif;
enddefine;
mydatabase.p ;;; shows ------->
lvars database;
[] -> database;
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com
--- End Message ---