Hello,

I am trying to use the learn aiml, I see that Mastablasta in one of his docs said

Before you end a session with your bot you need to use wq (write and quit) and hit enter.

Can anyone tell me where you enter the WQ. I have tried this but get nothing.

Thanks

Billc

juerg

8 years 4 months ago

tell us a bit more about your testing environment. are you in pandarobots playground or in mrl? in mrl use the swing gui and go to the tab with your bots name - or are you not that far yet? 

 

Hi Juerg, I hope this makes sence to you.

I am using mrl and programAB and Python. The bot will talk and I can teach him things but when I exit ( i just hit the red stop buttion). I then go back and look at my files an nothing has been added.

I tried the wq + enter on the python panel but nothing happens.

 

 
unds/29991233_dfeeeb2d3d0b3.mp3
[i01.mouth] [INFO] got HTTP/1.1 200 OK
[default:track] [INFO] playing file : audioFile\AcapelaSpeech\Peter\ed37c6e6fb45c6b4a626647099f9f1df.mp3  mode : queued trackId : 1467563238962
[i01.mouth] [INFO] onAudioStart i01.mouth file : audioFile\AcapelaSpeech\Peter\ed37c6e6fb45c6b4a626647099f9f1df.mp3  mode : queued trackId : 1467563238962
[i01.mouth] [INFO] publishStartSpeaking OK I will call you Bill.
[default:track] [INFO] Audio File publishAudioEnd
[i01.mouth] [INFO] onAudioEnd i01.mouth file : audioFile\AcapelaSpeech\Peter\ed37c6e6fb45c6b4a626647099f9f1df.mp3  mode : queued trackId : 1467563238962
[i01.mouth] [INFO] publishEndSpeaking OK I will call you Bill.
wq
wq+
 
I entered the wq at the bottom screen were you see the results. I also tried it from the python screen.
I do not know what i am doing at this point.
 
Thanks for any help you can give me.
BillC
 

hi you can call this from python :

 

chatbot.WriteAndQuit

or

chatbot.writeAIML

chatbot.writeAIMLIF

.

I m working on external and shared learning datastorage. it works great. sources soon

juerg

8 years 4 months ago

maybe you post your python script you are using to start your bot.

you could call the save command through an oob tag in a "SAVE SESSION" pattern. however I think you should experiment first with the playground in pandarobots. there you have all the buttons to add and modify the aiml file parts.

my method to extend the capabilities of the robot is currently to create a new aiml file and control the flow with topics. as all aiml files in the bots directory get loaded it can be a small and easy to edit file. In the swing-gui under the bot's name you can easily reload the files and check out your additions you made. If you do that in small steps (one pattern after the other) you can also quickly detect any errors you have made. It is rather easy to break the aiml file and it's not shown in the log what made it fail - it just does not get loaded.

pedrosenarego

8 years 4 months ago

In reply to by juerg

I am currently also testing the chatbot and my dificulties are to find a script that load the chatbot i want using webkit and acapela! ive tried harry and only can load Alice2 (default) never the bot i want. The onyl way i could load it was Running-startAPprogram-change name bottom instead alice "botname". But that way is not cool and no webkit or acapela :(

juerg

8 years 4 months ago

In reply to by pedrosenarego

Hi Pedro

It is in fact a bit of a problem to get the right bot loaded. I am using this sript and this folder structure:

aimlPath = "/home/odroid/marvinDialog"
aimlBotName = "marvin"
aimlUserName = "juerg"
botVoice = "Klaus"
 
marvin = Runtime.createAndStart("marvin", "ProgramAB")
marvin.setPath(aimlPath)
marvin.startSession(aimlUserName, aimlBotName)
 
mouth = Runtime.createAndStart("mouth", "AcapelaSpeech")
mouth.setLanguage("de")
mouth.setVoice(botVoice)
 
... and .aiml files in folder:
/home/odroid/marvinDialog/bots/marvin/aiml/
 
So  in the folder the aimlPath is pointing to you need a "bots/<your bot name>/aiml" folder and place the aiml files into that folder.
 
If you define your own general default pattern "*" with an answer like "I am Pedro" you can easily check whether your bot has been loaded or not.
Not loading the bot in my case was mostly syntax errors in the aiml file, so build it step by step.
 
In the swing gui in the <bot name> tab you can request the current aiml files to be reloaded when providing base folder, username and botname. Do a few iterations of updating an aiml file and you will soon be comfortable with this solution
 

BillC

8 years 4 months ago

In reply to by juerg

This is the java program that I am running. It works fine, untill I tell it  to learn.
It will learn my name but when I leave the program I can not fine any changes.
 
This program came from kwatters and I just changed a few things.. 
 
 
 
 
from java.lang import String
import threading
 
#############################################################
# This is the Jarvis script
# Harry is an InMooved powered by a Ras PI2
# Initially we'll start simple
# It will use ProgramAB & Webkit for all interactions with
# the bot.
#############################################################
# All bot specific hardware configuration goes here.
leftPort = "COM05"
#rightPort = "COM21"
#headPort = leftPort
 
#gesturesPath = "c:/mrl/ProgramAB/Jarvis/gestures"
 
aimlPath = "c:/mrl/ProgramAB/jarvis/"
aimlBotName = "jarvis"
aimlUserName = " "
botVoice = "Peter"
 
# toggle to only load program ab  and skip the inmoov services
 
startInMoov = True
 
 
######################################################################
# helper function help debug the recognized text from webkit/sphinx
######################################################################
def heard(data):
  print "Speech Recognition Data:"+str(data)
 
######################################################################
#
# MAIN ENTRY POINT  - Start and wire together all the services.
#
######################################################################
 
# launch the swing gui?
# gui = Runtime.createAndStart("gui", "GUIService");
 
######################################################################
# Create ProgramAB chat bot ( This is the inmoov "brain" )
######################################################################
jarvis = Runtime.createAndStart("jarvis", "ProgramAB")
jarvis.setPath(aimlPath)
jarvis.startSession(aimlUserName, aimlBotName)
 
######################################################################
# Html filter to clean the output from programab.  (just in case)
htmlfilter = Runtime.createAndStart("htmlfilter", "HtmlFilter")
 
######################################################################
# mouth service, speech synthesis
mouth = Runtime.createAndStart("i01.mouth", "AcapelaSpeech")
mouth.setVoice(botVoice)
 
######################################################################
# the "ear" of the inmoov TODO: replace this with just base inmoov ear?
ear = Runtime.createAndStart("i01.ear", "WebkitSpeechRecognition")
ear.addListener("publishText", python.name, "heard");
ear.addMouth(mouth)
 
######################################################################
# MRL Routing webkitspeechrecognition/ear -> program ab -> htmlfilter -> mouth
######################################################################
ear.addTextListener(jarvis)
jarvis.addTextListener(htmlfilter)
htmlfilter.addTextListener(mouth)
 
######################################################################
# Start up the inmoov and attach stuff.
######################################################################
i01 = Runtime.createAndStart("i01", "InMoov")
 
i01.mouth = mouth
    
# Harry doesn't have a forward servo, but i'm adding it here as a 
# place holder
#forwardServo = Runtime.start("forwardServo","Servo")
 
######################################################################
# Launch the web gui and create the webkit speech recognition gui
# This service works in Google Chrome only with the WebGui
#################################################################
webgui = Runtime.createAndStart("webgui","WebGui")
 
######################################################################
# END MAIN SERVICE SETUP SECTION
######################################################################
 
 
######################################################################
# Helper functions and various gesture definitions
######################################################################
#i01.loadGestures(gesturesPath)
 
 
 

Thank you guys, I can now load my not:) now my next quest is to be able to use an oob to for example load a .py to start right hand and set min max! Is it possible? Love my chatbot is the most funny part

Pedro, using BillC's script and wanting to call the "heard" function with the pattern "HEARD" you would need to add this to your aiml file:

<category><pattern>HEARD</pattern>
<template><oob><mrl>
    <service>python</service><method>exec</method><param>heard()</param>
</mrl></oob></template>
</category>
 
So you can't start a new python script (afaik, I might be wrong) but any function you have defined in the start script for programAB. This can also be a function sitting in one of your gesture files as these get loaded with the loadGestures() function.

the difference between a statement in the main python script and a statement in a function section "def func():" is only the time of executing. statements in the main part get executed when the script is started, statements in a function get only executed when the function is called.

beside this there is no restriction what a stateent has to look like.

so to save the chatbot's state (as of moz4r's reply) and using above function "heard()" you would add the "chatbot.WriteAndQuit" into the def section of "heard()"

replace "chatbot" with your chatbot's name.

sorry Bill, can't be of help for this as I never expected my bot to remember a last session thing. Thought it would go into the aimlif folder but the entries I found there do not make sense to me.

you could make it know its name by having a predicates.txt file in the config folder (same level as the aiml folder is) and add "name: jarvis"