ホストご自分のボットプラットフォームに ボットのリブレの企業ボット台
Self, AIML, and scripting : Evaluation flow, declaring new :response sentences and miscelany

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

による aazxcqwe 掲載 Jan 25 2015, 18:47

Yes, thanks, I was editing that in and to my last post about the same time you replied. Thanks. Also, after turning off all the Learning options the debug info is much more manageable.

Should I be able to use 'case #question .." with automatic declaration of instantiation to the variable's own primitive? I thought I saw this somewhere using 'case #isa ..'. That would also cut out a great deal of code.

So far :verb is not identifying "is", but I have workaround. Working on how to exclude from :unknown after defining new words. Will "exclude #word from :anything;" work or maybe I need to set up my definitions differently?

// This script looks for a subject and predicate of a sentence. State:SimpleLanguage { 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 "cancel" template "cancelled"; case :question goto State:sentenceState; do (if not (:unknown, #null) then (do (assign :subject to :unknown))); do(if (is :noun related to :noun by #instantiation, #true) then (do(assign :subject to :noun)) ); do (if not (:subject, #null) then (do (assign :object to :noun))); case :noun goto State:sentenceState; case :verb goto State:sentenceState; case :not goto State:sentenceState; case :adjective goto State:sentenceState; case :unknown goto State:sentenceState; case "?" goto State:sentenceState; case :anything goto State:sentenceState; :question {set #instantiation to #question;} :noun {set #instantiation to #noun;} :subject {set #instantiation to #thing;} :object {set #instantiation to #thing;} :not {set #meaning to #not;} :verb {set #instantiation to #verb;} :adjective {set #instantiation to #adjective; set #meaning to #description;} :unknown {exclude #meaning :anything; exclude #word from :anything; } Quotient:1.00:Equation:response; // (use ! in front for emphasis) Equation:response { assign :response to (new #sentence); append sentence("q:",:question, "n:",:noun, "s:",:subject, "o:",:object, "not:",:not, "v:",:verb, "adj:",:adjective, "u:",:unknown, "a:",:anything) to #word of :response; if not (:unknown, #null) and not (:verb, "is") then (do (return Formula:"0 What is {:unknown}? {:response}")); if (:subject, #null) then (do ( return Formula:"What is the subject? {:response}", assign :correction to (get #input from (get #input from :conversation at last 1)), associate :subject to :correction by #response, return )); if (:verb, #null) and (:adjective, #null) and (:object, #null) then (return Formula:"2 what is {:subject}? {:response}"); if (:verb, #null) then (assign :verb to #is); if (:adjective, #null) and (:object, #null) then (do ( assign :value to (get :verb from :noun), if (:value, #null) then (return Formula:"3 What does {:subject} {:verb}? {:response}") else (return Formula:"{:subject} {:verb} {:value} r {:response}") )); if (:adjective, #null) then (assign :adjective to :object); if (is :noun related to :adjective by :verb, #true) then (return "yes, that's true"); if (:not, #null) then (do ( associate :noun to :adjective by :verb, return Formula:"I understand, {:subject} {:verb} {:adjective}" )) else (do ( dissociate :noun to :adjective by :verb, return Formula:"I understand, {:subject} does not {:verb} {:adjective}" )); } } }


Id: 719702
掲載: Jan 25 2015, 18:47
更新: Jan 25 2015, 19:29
回答: 0
眺望: 1690, 今日の: 2, 週間: 3, 月: 8
0 0 0.0/5