Thumbnail

Aimlbot

by Synthiam

AimlBot is a localized chatbot client that uses AIML (Artificial Intelligence Markup Language).

How to add the Aimlbot robot skill

  1. Load the most recent release of ARC (Get ARC).
  2. Press the Project tab from the top menu bar in ARC.
  3. Press Add Robot Skill from the button ribbon bar in ARC.
  4. Choose the Artificial Intelligence category tab.
  5. Press the Aimlbot icon to add the robot skill to your project.

Don't have a robot yet?

Follow the Getting Started Guide to build a robot and use the Aimlbot robot skill.

How to use the Aimlbot robot skill

AimlBot is a localized chatbot client that uses AIML (Artificial Intelligence Markup Language). The AIML configuration files are stored locally and can be edited by hand or with an AIML editing tool. Additionally, settings for the session can be adjusted programmatically using the ControlCommand. 


Main Window


User-inserted image

1. Text Entry Field
This is where you write your text entry.

2. Send button

Click the Send button, or hit enter when you are ready to send your text entry to the AimlBot.

3. Response Display

This is where the AimlBot will respond with its text-based response.

Settings


User-inserted image

1. Response Variable and Script
AIML responses can embed ez-script with square brackets [ and ]. For example, if you load the AIML file t.aiml, you will find this example under the category "test." Search the document for the word "test" and see the following response...

Code:

This is just a test $Direction.[say("Testing")]

As you can see in the above example, when the word "test" is entered as a phrase into the artificial intelligence engine, the response includes a variable and a script to run.

2. Open Config Folder
You can specify the configuration folder to have multiple personalities per project. The new config folder must contain the CONFIG and AIML folders from the plugin root folder. Look in the current config folder of this plugin, and copy the AIML and CONFIG folders into the new folder. Specify the new folder by pressing the change configuration folder button. This value is saved per project.

*Note: make a copy of the AIML files if you will be making modifications to them. The files may be overwritten during robot skill updates. Here's a video explaining how to make a copy of the default files into a new folder so you can edit them.

3. Open AIML Editor
Please note that the AIML editor requires .Net 3.5 to be installed. The config menu of this plugin has a button to open the AIML config folder or search for a phrase among all AIML files. The file search-ability makes it easy to find a response to edit with your editor, such as with a notepad. There's also a built-in editor that I've included; more info is below.

GaitoBotEditor
Springwald Software created a built-in editor called GaitoBotEditorGaitoBotEditor was developed by Springwald Software with no relation to Synthiam. Synthiam cannot support or assist with using this AIML editor, but their online manual is straightforward. The AIML files will have to be loaded into the editor as a new workspace. We don't have much experience with the editor, but it seems to do the trick! The GaitoBotEditor requires .Net 3.5 to be installed.

4. Search
You may open the AIML editor directly with the Open AIML Editor button in the settings menu. Otherwise, if you're looking for files related to specific keywords, the SEARCH option will be helpful. If you want to modify all responses to the word " Banana," type the word "Banana" and press SEARCH. The interface will prompt a menu asking if you wish to open all the files corresponding to that word.


Session Settings Memory


Each session starts with a fresh memory. The default value can be specified by editing the config settings files on startup. However, during the chat session the values can be altered. They can be altered by either entering phrase to alter them, or programatically with the SetValue ControlCommand().

Here is an example of altering the value by speaking to the chatbot. The name of the user has been changed to Mr. Bob by telling the chatbot the value.
User-inserted image


Alternatively, the same value can be changed by a script. For example, if the Camera Device is combined with the Cognitive Face robot skill, the chatbot can be told who you are. The example syntax would be

Code:


ControlCommand("AimlBot", "SetValue", "name", "Mr Bob")


All setting data from the current session can be viewed by selecting the Show All Settings option in the dropdown.
User-inserted image




Control Commands


A few ControlCommand for interacting with this skill programmatically from other robot skills. 

- SetPhrase
This will set the phrase as if typed into the user input box. If using a speech recognition robot skill, this is the ControlCommand to send the user's spoken phrase text.

- SetValue
This will set the value in the session to your specified value. For example, you can set the value NAME to "Bob," and the chatbot will now know you as Bob. Interacting with settings can be done by asking the chatbot a setting value, such as 'What is my name?' or 'What is my birthday?'. You can configure these settings with text by entering 'My name is Bob' or 'My birthday is Friday', and the chatbot will know those values. 

*Note: All settings can be viewed by selecting the View All Settings option in the menu dropdown on the main screen.


How to Use AimlBot Skill


1) Add the AimlBot Skill to your ARC project (Project -> Add Skill -> Artificial Intelligence -> AimlBot).

2) Enter your text into the text field in the main window.

3) Click the Send button. 

4) Read the response in the response display. 

Script Samples



The AilmBot skill accepts control commands to get data from other skills. This means if you use the speech recognition skill like Bing Speech Recognition, you can send a speech-to-text entry directly to the AimlBot text field with:

Code:

ControlCommand("AimlBot", "SetPhrase", $BingSpeech)

This skill also can execute a script when the chat result is returned. AimlBot can speak the result with:

Code:

Say($BotResponse)
-or-

Code:

SayEZB($BotResponse)

Another feature of this skill is moving a robot based on the code entered in the updatetime file. An example phrase to activate this is: Move Forward.

ARC Pro

Upgrade to ARC Pro

Experience early access to the latest features and updates. You'll have everything that is needed to unleash your robot's potential.

#52  
I want to add AIML code dynamically, that is asking my robot to learn new AIML data and then use that data without reloading the AIML configuration manually. Is there anyway to "load AIML configuration" programically? While it is quite easy to add a line of text to an AIML file, I have found no way to restart the AimlBot skill so that it loads my new AIML code.
PRO
Synthiam
#53   — Edited
That can be done. 

please do not double post. Other post was deleted.
PRO
Synthiam
#55   — Edited
Added Reload Config button and ControlCommand for reloading the config programmatically
#56   — Edited
Thanks DJ! The button works PERFECTLY!:) I haven't tried using the command programmatically yet.
#57  
So this is really cool. Still I want to dynamically add to an AIML file and use the newly added code right away. But I can't because the new line of code is placed at the end of the file--after the "</aiml> tag which breaks AIMLBot requiring me to manually move the tag. I know I could probably read, store, and rewrite the entire existing AIML file into memory, delete the </aiml> tag, add the new code, and finally place the tag at the end of the file, but does anyone have a better idea? 

My code: 

Code:

saywait("When you hear the beep please add new input.")
sleep(2000)

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

saywait("New input was learned.")

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

$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.")



$sAIMLLineOfCode = ""+ $sAIMLInput + " " + $sAIMLOutput + " "

print($sAIMLLineOfCode)

FileWriteLine("c:/AIMLCode.aiml",$sAIMLLineOfCode)
saywait("New AIML was added to the file")
PRO
USA
#58   — Edited
Hi Tom, I re- worked my AIML code this morning and tried you script, it does add responses.

EzAng
#59  
Ez, I have a new bit of code that creates a new file each time with the <aim> tags as needed. It also allows multiple "categories" to be added. I will try to post it into a tutorial. I didn't have much luck with the tutorial last time. I couldn't make it "public." Otherwise, I'll put the code here tomorrow.
#60  
Again, I had no luck in making a tutorial, so here is my updated code. It also allows multiple "categories" to be added and then reloads the configuration so that the new AIML can be used without stopping your robot. Each time it is invoked it creates a new aiml file (complete with the start and stop tags) with a unique name so that it doesn't overwrite any existing ones. 

make sure to customize your $AIMLPath variable so that it points to your aiml file. 

Code:

#say("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
#61  
@Thomas,
is there any instructions anywhere on the web how to use the editor.
thanks in advance.
#63  
Thanks DJ,  Looks like it;s German, I think I get the jest of it.
PRO
Synthiam
#64  
I noticed that as well - it's not very well documented. It would be nice to find a manual for it. I thought there was a webpage or some help file included with the program? Is there anything in the installation folder?
#65  
v21 has been updated 

- new ControlCommand added that allows specifying "memory" values of the current session programatically. For example, you can set the user's name with

Code:


ControlCommand("AimlBot", "SetValue", "name", "Mr Bob");


And when the chatbot is asked "What Is My Name?", the chatbot will respond with the name.
User-inserted image


- There is a new option to view all memory settings
User-inserted image


All settings and their values will be displayed....
User-inserted image
#66  
Is it possible to save customized AIML files with a project when uploading to Synthiam's cloud?
PRO
Synthiam
#67  
Not at the moment - it is a third-party engine that uses its files with the extension aiml that aren't part of the project. I believe the robot skill could somehow be modified to include the files, but it would take significant development effort to modify the third-party aiml engine.
#68  
I don't think you follow me. I mean that I have configured some 100 different AIML files for my Simone project. When I save the project, I want those AIML files saved WITH the project. That way, when people download my project, they get the AIML files as well. You allow saving of a servo profile, perhaps you can save the AIML files somewhere on your cloud. Maybe if they were zipped up into a single file. Otherwise I will have to use Google Drive, GitHub or some other similar file sharing service. Thoughts?
PRO
Synthiam
#69  
I did follow you. My response is still the same :). A project file and 100 individual random files are different. Being that the aimlbot is a 3rd party engine, it’s not designed to load data from an ARC project file. It doesn’t know what an ARC project file is. It knows it’s files. So significant development effort would be required to rewrite the 3rd party robot skill to somehow load and save data from a project file or a cloud.
#70  
I understand the complexity of having AimlBot load the AIML files itself. I agree that would probably be a lot of work.

But how about if you were to allow us to store a single extra file with the project file. That would be a bunch of AIML files all zipped together. Then the users would download both the project file and the zipped AIML files. And then the users would be required to manually unzip the file and put the individual files into the proper directory.  This way, there is no rewriting the skill, just allowing an extra file to be stored and downloaded with the project file. Yes? No?
PRO
Synthiam
#71   — Edited
Again, the engine is a 3rd party product. We’d need to coordinate to have that feature added. I have not said it couldn’t be done. It will require significant development effort and it would have to be added to their development scope. It’s just not something that could be added right away. It would take some planning and discussion but it can be done