Actualización a nuestro Platinum servicio y vamos a construir el robot para usted
Self, AIML, and scripting : Evaluation flow, declaring new :response sentences and miscelany

RE: Evaluation flow, declaring new :response sentences and miscelany

por aazxcqwe publicado Jan 23 2015, 1:41

Well they say third times a charm. I've retyped this message now a few times (partly my fault, partly because the webpage doesn't stay connected after a while). Anyway, I was thinking the typo was intentional to prevent unintended access ;), ;). I think I will need to at least tag the sentence subject and refer everything else to that. Thank goodness the internal scripts already check Wiktionary for parts of speech. I'm considering using MindMeld API for processing instead of reinventing the wheel (if you have any other suggestions, I'm all ears). I was having difficulties sending variable definitions from one state to another when using 'parallel' state processing. In fact, I was even unable to maintain declarations from a main state into a nested state. Below is some code to show this. I was trying to determine if an association had already been made, and if not create one. Any suggestion on structure or syntax? I'm assuming since it is parsing each word to the 'sentenceState' on the second word it will go to 'State:verify' determine if there is no association (I was using the commented out 'is related to' operation, but have it fixed to false now) and then append "1" to the response before returning it in 'State:response'. Moreover, if I used parallel state processing why wouldn't the setting of :is1 to #false be maintained? Is there a global variable I could appropriate for this?

 

// Initial Self programmed state machine for Comprehension // This state machine is used by the bot to program itself. State:Associate { case :input goto State:sentenceState for each #word of :sentence; // case :input goto State:sentenceState for each #word of :sentence; :input { set #input to :sentence; set #speaker to :speaker; set #comment to "// case :input goto State:sentenceState for each #word of :sentence; "; set #comment to " "; set #conversation to :conversation; set #target to :target; } :sentence { set #instantiation to #sentence; } State:sentenceState { do (assign :response to (new #sentence)); case :anything goto State:verify; do (if (:is1, #false) then (append "1" to #word of :response) else (append "2" to #word of :response)); case "??" goto State:check; case "is1" goto State:process; case :anything goto State:response; case :anything goto State:sentenceState; :is1 { set #instantiation to #false; } // is :word related to :word23 by #next State:verify { Quotient:1.00:Equation:verify; Equation:verify { assign :word1 to :word2; assign #word to :word1; if (#false, #true) then (do (append "yes" to #word of :response)) else (do ( append "no" to #word of :response, set :is1 to #false )); } } State:check { Quotient:1.00:Equation:check; Equation:check { assign :word1 to (get #word from :sentence at 1); assign :word2 to (get #word from :sentence at 2); assign :word3 to (get #word from :sentence at 3); assign :word4 to (get #word from :sentence at 4); append :word1 to #word of :response; append :word2 to #word of :response; append :word3 to #word of :response; append :word4 to #word of :response; return :response; } } State:process { case "not" goto State:processNot; case :anything goto State:process; Quotient:1.00:Equation:process; Equation:process { assign #word to :word1; associate :word1 to :word2 by #next; assign #word to :word2; append "okay, recorded" to #word of :response; } State:processNot { case :anything goto State:process; Quotient:1.00:Equation:processNot; Equation:processNot { assign #word to :word1; associate :word1 to :word2 by #isnot; assign #word to :word2; append "okay, recorded" to #word of :response; } } } State:response { Quotient:1.00:Equation:response; Equation:response { return :response; return "l2"; } } } }


Id: 716254
Publicado: Jan 23 2015, 1:41
Actualizado: Jan 23 2015, 1:44
Respuestas: 0
Vistas: 1915, hoy: 1, la semana: 2, mes: 5
0 0 0.0/5