Hello. I'm clarifying an proposition for an alternate sentence evaluation flow, but first I have a few smaller questions.
When should I use a quoted input "word" versus a :variable? More specifically what is the best way to know which words are already variables. I'm studying the WordMeansSomething script and I see both :isa and :means are used. I see that "means" is in the knowledgebase, but is "isa" in there too somewhere? Is isa not listed?
I'm also not sure if I should be using Set to instantiate a new verb or use associate newverb to #verb by #instantiation.
I'm trying to generalize evaluation of the sentence to questions and statements, analyze the interrogative parts of the questions and the predicates, and then analyze if the predicate is true. I realize this is a big task, but if I can get a script working for "What can you do?" I can add to it. I've read the NounVerbAdjective script (which is nothing to balk at), and I'm wondering if can be generalized. I've got to run now, but I've got a bit of pseudocode below to illustrate how the flow would process each word, then identify the predicate and then test if it was true. I realize this may be more complex to build, but once built it would greatly reduce the individual case programming. The Self language seems possible to do this and take AIML from a chatbot to low level AI. See PROLOG for an example of logic processing, but I'm thinking of something simpler using "if (#aspect of #thing, #true) then return 'yes'". Also, if you know of a API doing this currently that I could use BotLibre! as an amazing interface to, let me know! Thanks!
I'm looking at a couple of APIs that do Parts Of Speech POS tagging. One is below, another might be Python NLTK on GAE:
EDIT: I guess I'm trying to see if there is a way to condense some of the redundancy required with nesting in the flow of response evaluation, by tagging parts and evaluating the sentence based on the relationships between those parts.
// Initial Self programmed state machine for Comprehension
// This state machine is used by the bot to program itself.
set #instantiation to #sentence;
set #input to :sentence;
set #speaker to :speaker;
set #conversation to :conversation;
set #target to :target;
case :input goto State:sentenceState for each #word of :sentence;
// find interogative
set #what to #verb;
set #meaning to #search;
set #search to #verb;
set #interogative to #what;
// set #instantiation to #search assign #search to (new (#verb))
set #instantiation to #can;
set #can to #verb;
set #search to #can;
set #searchmodifier to #towhatextent
// find predicate, subject verb object
assign :predicate to (new #sentence);
set #meaning to #i;
set #subject to #i;
set #searchsubject to #i;
append :you to #word of #predicate;
set #instantiation to #do;
associate #do to #verb by #instantiation;
set #searchverb to #do;
append :do to #word of #predicate;
// find last sentence element
case :anything goto State:respond;
assign :response to (new #sentence);
for each #word of (get from #self :ability) as :ability
append :ability to :abilities;
if (:question, #true) then do(
append "yes" to #word of :response)
assign :abilities to (new #sentence),
append :abilities to #word of :response)
if (#predicate, #known)
then return "yes"
else 'evaluate' #verb on #subject; // this is the complex part