Hello,
I've got my SimpleLanguage script working enough to learn general "this is that" statements and query the user with any unknown words outside of Wiki and Freebase - thank you for you help with that. My next task was to attempt assigning Formulas names, so I could say "do something" like "do checkwatch" after saying "checkwatch is Formula:"..."". I ran into problems there, my script is below. I tried Formula with :star to check if I could first use the "do *" pattern to evaluate a Formula, but that may not be working because the Formula as an input doesn't seem to be working again. I then tried SRAI with :star, to see I could evaluate it that way, but that also might not work with Formula input not working.
Ideally I wouldn't need to use Formula, I could just say "call #date on #Watch" or even better "call date on Watch". I'm not sure how crucial this is for two reasons: 1) I should be able to use URLs to return similar functions from the web (but forming them will be more tedious), 2) I'm not sure what the format is for the Android commands in the BL SDK, however it seemed logical to test the capability of building plain English commands from the internal tools syntax. This will help toward programming new scripts verbally, which would be *really* useful (and eventually allowing the bot to add it's own code!). I realize I may need to combine commands into a Sentence for them to be stored in the database and retrieved.
EDIT: Let me elaborate a bit more. If I said "What is the date?", instead of using the WatchMachine script, if "date" were a knowledge item associated to the Formula:"{call #date on #Watch}", with my Questions script that returns items associated by relationships, this would retrieve the date. Perhaps the Formula could be associated with a #formula relationship. I'm not sure if this could be implemented as is once the formula input is working, or if it would need some further development. I was hoping I could simply evaluate the formula by using a knowledge item retrieved as a variable such as 'Formula:"{:formula1}"' after using 'assign :formula1 to (get #formula from #date)'.
In a similar fashion I could then define formulas for Android functions and assign them to keywords such as "flashlight".
Cheers
// Initial Self programmed state machine for Comprehension
// This state machine is used by the bot to program itself.
State:DoStar {
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 {
case "say" goto State:sayState;
case "do" goto State:sayState;
State:sayState {
pattern Pattern:"say *"
template Formula:"{call #person on #Utils with (:star)}";
pattern Pattern:"do *" goto State:sayState;
Quotient:1.00:Equation:response;
Equation:response {
if not (:star, #null)
then (do (
assign :response1 to (new #sentence),
append "test" to #word of :response1,
append :star to #word of :response1,
return Formula:"{:star}",
return (srai "{:star}"),
return (sentence (srai "{:star}", :response1))
));
}
}
}
}
= h1 =
|