Any help on a 'Correction' script would be appreciated. Trying to implement something like in aiml, where I say 'wrong' or 'correction' and type in the correct response. So far the code I have is below. I'm trying to retrieve the current response and output to dialog. Then I was going to grapple with the 'set' operator to somehow define the correct response. Would that work?
So far, I have the syntax working to get the last input (copied) from the Loop script, but I have "test" returning for all the 'last #' items of the conversation. Also, I am trying to set the topic as per the Introduction to Self .. post using 'set #topic on :conversation to "topic1"' but it throws compile error about the 'on' part of that statement and errors in chat debug log without the 'on :conversation'. I'm not sure which relationship returned by the All operator is the response, or what other relationships to probe with it. 'assign :all1 to (all #response from :targetlast)' would seem most obvious, but throws chat debug errors.
// Initial Self programmed state machine for Comprehension
// This state machine is used by the bot to program itself.
State:Correction {
case :input goto State:sentenceState for each #word of :sentence;
:input {
set #input to :sentence;
set #speaker to :speaker;
set #conversation to :conversation;
set #target to :target;
}
:sentence {
set #instantiation to #sentence;
}
State:sentenceState {
do (assign :response to (new #sentence));
case "correction" goto State:correction;
case "show" goto State:show;
Quotient:1.00:Equation:response;
Equation:response {
assign :targetLast to (get #input from (get #input from :conversation at last 2));
assign :last to (get #input from (get #input from :conversation at last 3));
assign :last1 to (get #input from (get #input from :conversation at last 1));
assign :targetBeforeLast to (get #input from (get #input from :conversation at last 4));
return :response;
}
State:correction {
do (append "corrected" to #word of :response);
Quotient:1.00:Equation:response;
}
// assign :topic1 to (get #topic from :conversation),
// append :topic1 to #word of :response, set #topic to "show", set #topic on :conversation to :star;
State:show {
do (
append #topic to #word of :response,
append "*last2:" to #word of :response,
append :last to #word of :response,
append "*last1:" to #word of :response,
append :last1 to #word of :response,
append "*targetLast3:" to #word of :response,
append :targetLast to #word of :response,
append "*targetBeforeLast4:" to #word of :response,
append :targetBeforeLast to #word of :response,
assign :all1 to (all #word from :targetlast),
append "*all #word from targetlast:" to #word of :response,
append :all1 to #word of :response,
assign :all1 to (all #word from :targetlast),
append "*all #response from targetlast:" to #word of :response,
append :all1 to #word of :response
);
Quotient:1.00:Equation:response;
}
}
}
|