Add New AIML Categories with Your Voice

Add Main Script Code - Change the Path as Needed

saywait("Starting A I M L learning")

##SoundNote("c2",2000)
$UniqueTime = $year + "." + $month + "." + $day + "-" + $hour + "." + $minute + "." + $second
$AIMLPath = "C:\Users\Thomas\Documents\AIML_Simone\aiml"
$AIMLFilename = $AIMLPath + "\0AIMLCode" + $UniqueTime + ".aiml"
print($AIMLFilename)

FileWriteLine($AIMLFilename,"")

$bLearningAIML = true

:AddNewAIML


#################  ADD INPUT  ###############
saywait("When you hear the beep please add new input.")
sleep(1000)

saywait("beep")
sleep(200)
controlCommand("Bing Speech Recognition", "StartListening")
controlCommand("Bing Speech Recognition", "UnpauseListening")
sleep(3000)
controlCommand("Bing Speech Recognition", "PauseListening")
controlCommand("Bing Speech Recognition", "StopListening")
#sleep(2000)
$sAIMLInput = $BingSpeech
print($BingSpeech)
saywait("New input was learned.")


#################  ADD OUTPUT  ###############
sleep(2000)
saywait("When you hear the beep please add new output.")
sleep(1000)

$bLearnAIML = true
saywait("beep")
sleep(200)
controlCommand("Bing Speech Recognition", "StartListening")
controlCommand("Bing Speech Recognition", "UnpauseListening")
sleep(3000)
controlCommand("Bing Speech Recognition", "PauseListening")
controlCommand("Bing Speech Recognition", "StopListening")
sleep(2000)
$sAIMLOutput = $BingSpeech
saywait("New output was learned.")
print("Heard:" + $BingSpeech)

$sAIMLLineOfCode = ""+ $sAIMLInput + "  " + $sAIMLOutput + " "
print($sAIMLLineOfCode) 

FileWriteLine($AIMLFilename,$sAIMLLineOfCode)
saywait("New AIML was added to the file")
sleep(1000)


############  DOES USER WANT TO ADD MORE?  #############
saywait("do you want to add another category?")
sleep(1000)

saywait("beep")
sleep(200)
controlCommand("Bing Speech Recognition", "StartListening")
controlCommand("Bing Speech Recognition", "UnpauseListening")
sleep(2000)
controlCommand("Bing Speech Recognition", "PauseListening")
controlCommand("Bing Speech Recognition", "StopListening")
sleep(1000)
$sAnotherYesNo = $BingSpeech
print("Heard:" + $BingSpeech)

if($sAnotherYesNo = "Yes")
  goto(AddNewAIML)
endif 
print("Heard:" + $BingSpeech)


############  FINALIZE AND WRITE NEW FILE  ##############
sleep(1000)
saywait("Finalizing A I M L document.")



FileWriteLine($AIMLFilename,"")
sleep(2000)
controlCommand("AimlBot", "ReloadConfig")

saywait("The new A I M L file is ready to use.")

$bLearningAIML = false


Open the settings dialog of the new script you created. Paste the above code into it. save the settings.


ARC Pro

Upgrade to ARC Pro

Unleash your creativity with the power of easy robot programming using Synthiam ARC Pro

#1  

Hello Super le code . Merci beaucoup .

PRO
USA
#2   — Edited

nice program will try it out

#3  

@Thomas,

Hi Thomas.  If you have time could you make a video of each step to make this work. I am having a hard time following your steps to crate AIML using my voice.  Do I need other plug-in to make this work.

Thank you in advance. Cheers

#4  

this is excellent, just what i was looking for:D

#7  

Yes that is what I am using... i am using that and part of your code to listen...

Wait for user voice input and store input

controlCommand("Bing Speech Recognition", "StartListening") controlCommand("Bing Speech Recognition", "UnpauseListening") sleep(3000)

print($BingSpeech)

this all works

then I do this... if ($BingSpeech = "how are you")

do something

Endif

even though the $BingSpeech printed "how are you" from my voice, the If statement does not fire am I missing something?