applescript - how can you integrate speech recognition into apple script and understand key words and more than a few word -


this example of simple code i'm using virtual assistant:

tell application "speechrecognitionserver"     set theresponse listen {"good", "bad"} prompt "how you?"     if theresponse "good"         "wonderful sir… there want me you?"     else         "cheer chap! there want me you?"     end if end tell 

can develop more, can understand more 2 words , understand keywords?

you could, assume, use 2 lists, 1 stands "good", , stands "bad":

set good_list {"good", "fine", "i'm fine", "ok", "okay"} --list of words, meaning "good" set bad_list {"bad", "irritated", "fustrated", "depressed"} --list of words, meaning "bad" set complete_list good_list & bad_list  tell application "speechrecognitionserver"     set theresponse listen complete_list prompt "how you?"     if (good_list contains theresponse)         "wonderful sir… there want me do?"     else if (bad_list contains theresponse)         "clear up, chap! there want me do?"     end if end tell 

remember, more words or group words include in list, more script can understand!

if want to, make more intelligent, using spoken answer (of user), in sentence computer say. this:

set good_list {"good", "fine", "i'm fine", "ok", "okay"} --list of words, meaning "good" set bad_list {"bad", "irritated", "fustrated", "depressed"} --list of words, meaning "bad" set complete_list good_list & bad_list  tell application "speechrecognitionserver"     set theresponse listen complete_list prompt "how you?"     if (good_list contains theresponse)         if theresponse = "i'm fine"             set theresponse "fine" --otherwise weird sentence         end if         theresponse & " sir! there want me do?"     else if (bad_list contains theresponse)         if theresponse = "bad"             set theresponse "feeling bad" --otherwise weird sentence         end if         "oh, " & theresponse & "? well, clear chap! there want me do?"     end if end tell 

sorry, had correct text mistakes (:


Comments