Upgrade to our Platinum service and let us build your bot for you
Bugs and Features : Define formula response not working?

RE: Define formula response not working?

by aazxcqwe posted Jan 12 2015, 22:08

Brilliant! Thanks, the WrongAnswer script worked a treat. It would have taken me a bit to figure out that "last 1" is the next user response in the conversation and to run a text only reply equation but have the following state's case accept anything as the response. Even the using associate and the connection between pattern "*" and {:star} would have taken quite some time. Thank you. I learned a lot just in that one script example.

The Formula entry works great too! It will no doubt be helpful when building knowledge when I'm out and about on my mobile. So thanks for that too!

My next task is to create an "first .., then .." parsing script. I haven't doven into whether I'll be able to reference equations in other scripts by using some kind of evaluate command. Any ideas again would be great. But a big thanks again for the above two efforts which are really key to getting rolling.

EDIT: Is there a way to use 'get' to return an action from another script similar to getting the time from the Watch tool (Formula:"The current hour is {get #hour from (call #time on #Watch)}")? For example, could I return hourResponse directly from the WatchStateMachine script, like "do (get hourResponse from WatchStateMachine)"? I would use this in an First/Then script, to say "First tell me what time it is, then open the url www dot google dot com". I will check out if :srai can do this.. Perfect, yes it does. I'm just hungup on how to parse the sentence "first ... then" where all of "..." would be assigned to :task1. I'm studying the PlusStateMachine parsing of "123 + 123", but not sure how :left and :right are defined.

As an aside, I think it is interesting you guys have chosen to parse each word in the scripts. In aiml they add each variation of a phrase. Parsing each word must be more efficient, though the readability seems less. I think if referencing other script actions is possible, it might be the best of both approaches. Say for instance there was (another) general script for "What is/are..." that redirected to other scripts such as "the time ..?" and "the capitol ..?". And those scripts branched off into "is it now?" or "is it in Denmark?" and "of France?" or "of Peru?". Essentially, they could be added together like extensions, yet each of the 'core' 'hubs' of the script 'network' would be manageable and readable. Kind of like what you've done for the knowledgebase, but showing the relationships between the scripts. In the example, showing "what" can redirect to the WatchStateMachine or to the WhatIs scripts.

EDIT2: Almost have this working, but I'm getting an error on the 'then' part of the for.. if statement below. It does parse (but the whole sentence for the first phrase) and the srai does work if the second commented line is used instead of the for each line.

// Initial Self programmed state machine for Comprehension // This state machine is used by the bot to program itself. State:FirstThisThenThat { 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 :task1 to (new #sentence)); do (assign :task2 to (new #sentence)); case "First" goto State:phrase1; Quotient:1.00:Equation:response; Equation:response { return (sentence (:task1, :task2)); srai :task1; srai :task2; } State:phrase1 { do(for each #word of :sentence as :word do (if not (#word, "then") then (do(append :word to #word of :task1)))); // do (if not (:anything, "then") then (do (append :anything to #word of :task1))); // do (append :anything to #word of :task1))); case :anything goto State:phrase1; case "then" goto State:phrase2; Quotient:1.00:Equation:response; State:phrase2 { do (append :anything to #word of :task2); case :anything goto State:phrase2; case :punctuation goto State:end; State:end { Quotient:1.00:Equation:response; } } } } }


Id: 703898
Posted: Jan 12 2015, 22:08
Updated: Jan 13 2015, 0:48
Replies: 0
Views: 1633, today: 1, week: 2, month: 9
0 0 0.0/5