Welcome to Synthiam!

Program robots using technologies created from industry experts. ARC is our free-to-use robot programming software that makes features like vision recognition, navigation and artificial intelligence easy.

Get Started
Asked — Edited

Help With Error On $Botresponse Aiml

Quick question as I am editing the settings file for the AIML Bot plug in. I got a clean set up with just the AIML Bot plug in. Mostly works just fine, but on occasion I get a correct $BotResponse that is not spoken, with an error message. Can anyone tell me whats happening.

Again correct response is given, just wont speak the response do to error?!


User-inserted image

AI Support Bot
Related Content
Synthiam
Based on your post activity, we found some content that may be interesting to you. Explore these other tutorials and community conversations.
PRO
Synthiam
#1  
Stop putting new blank lines in your AIML
PRO
USA
#2  
New blank line? To my knowledge I've not added a blank line anywhere, just simply replacing what is there. Can you explain.




User-inserted image
PRO
USA
#3  
Maybe notepad is adding something? What should i be editing with?
PRO
Synthiam
#4  
You only showed Star Wars as an item from the config. You did not look at the actual response source.

I’m not able to provide assistance on using aiml because I don’t have much experience. But I can recommend looking at the source files and not only the config.
PRO
USA
#5  
@DJ,

I believe the plugin needs to strip some characters to avoid get stuck in the ARC's regular expressions.

I just added the AIM bot (no changes)

And i asked the question "favorite movie?"

User-inserted image


I tried to process the $BotResponse in a EZ-Script script and i get similar errors.
PRO
USA
#6  
No problem, maybe someone else will chime in.

I didn't alter any of the response files, only the settings config file.
#7  
Hi

I havé Hadrien the same problèmes in my synbot plugin and have add a filterîng code in the plugin
PRO
Synthiam
#9  
ptp, is it new lines in the source files? It looks like some number of characters in the screenshot. I've been out at a conference all day and traveling - I'll take a peek now that i'm back at my hotel
United Kingdom
#11  
I noticed these similar errors as well on certain bot responses. Like Will said, the bots response will show up in the text response window, but not spoken using either Say() or SayEZB() and shows an error in the ARC debug window. Do you also notice the large spaces in the sentence of the bots response that is NOT spoken (look for n post #6). A spoken response will not have this large space and a response that is not spoken with a debug message, will.

After some troubleshooting, I did find one possible cause in some of the AIML files. Don’t quote me on the exact tags as I’m not near a computer right now, but It had something to do with a bots template response that contained < Set > < Name > or < Topic > tags. The tags actually fit in the large spaces in the sentence of the bots response I mentioned above. It’s essentially giving two responses in one sentence, the first half of the sentence, then the topic which contains and redirects to the second part of the sentence, and I think there in lays the problem.

User-inserted image


Example: First part of the response...

My favourite movie is 2001 a space Odyssey.

Then the topic tags that sets the movie name, followed by the second part of the response (look in the AIML response window in post #6, you will see the large space between the above response and the one below), ...

Have you seen 2001 a space Odyssey?

What I tried on one response that gave a debug error, was to delete the above Name, Set and Topic tags and left just the Category, Pattern and template tags with the original user question and slight change to the bots template answer as I removed the set topic for the movie name, so instead of Have you seen 2001?, I put Have you seen it?. Saved the edited file, reloaded it in the AIML control and this actually did stop the debug error and the response was spoken. Did this on a couple more responses with the same results. Not an ideal fix but good for trial and error as I got a result and hopefully will help with finding a solution.

I had the error pop up with favourite movie, fav band and fav song. I’m still going through this and when I’m by a computer tomorrow, I’ll see if I can find the exact AIML tags that throws the error up and let you guys know. Hope what I have posted so far is of some help.

Steve.
PRO
USA
#12  
@Steve G:
The problem is related to the linefeed character 0x0A.

A temporary fix script:

create a file "fix_linefeed.vbs" paste the following content/script:

Code:


Option Explicit

Main

Sub Main
Dim Path
Dim FileName
Dim Files

Path = "C:\Users\Public\Documents\EZ-Builder\Plugins\aa184830-399a-4716-bdfc-e766fd792a51\aiml\*.aiml"
Files = ListDir(Path )
If UBound(Files ) = -1 then
WScript.Echo "No aiml files found."
Else
For Each FileName In Files
WScript.Echo FileName
FixLineFeed(FileName )
Next
End If

Path = "C:\Users\Public\Documents\EZ-Builder\Plugins\aa184830-399a-4716-bdfc-e766fd792a51\config\*.xml"
Files = ListDir(Path )
If UBound(Files ) = -1 then
WScript.Echo "No xml files found."
Else
For Each FileName In Files
WScript.Echo FileName
FixLineFeed(FileName )
Next
End If
End Sub



Public Sub FixLineFeed(ByVal FileName )
Const ForReading = 1, ForWriting = 2
Dim fs, txt, contents

Set fs = CreateObject("Scripting.FileSystemObject" )
Set txt = fs.OpenTextFile(FileName, ForReading )
contents = txt.ReadAll
txt.Close

contents = Replace(contents, vbCr & vbLf, "[CR-LF]" )
contents = Replace(contents, vbLf, "[CR-LF]" )
contents = Replace(contents, vbCr, "[CR-LF]" )
contents = Replace(contents, "[CR-LF]", vbCR & vbLf )

Set txt = fs.OpenTextFile(FileName, ForWriting )
txt.Write contents
txt.Close
End Sub


Public Function ListDir (ByVal Path )
Dim fso: Set fso = CreateObject("Scripting.FileSystemObject" )
If Path = "" then Path = "*.*"
Dim Parent, Filter
if fso.FolderExists(Path ) then ' Path is a directory
Parent = Path
Filter = "*"
Else
Parent = fso.GetParentFolderName(Path )
If Parent = "" Then If Right(Path,1 ) = ":" Then Parent = Path: Else Parent = "."
Filter = fso.GetFileName(Path )
If Filter = "" Then Filter = "*"
End If
ReDim a(10 )
Dim n: n = 0
Dim Folder: Set Folder = fso.GetFolder(Parent )
Dim Files: Set Files = Folder.Files
Dim File
For Each File In Files
If CompareFileName(File.Name,Filter ) Then
If n > UBound(a ) Then ReDim Preserve a(n*2 )
a(n ) = File.Path
n = n + 1
End If
Next
ReDim Preserve a(n-1 )
ListDir = a
End Function

Private Function CompareFileName (ByVal Name, ByVal Filter ) ' (recursive )
CompareFileName = False
Dim np, fp: np = 1: fp = 1
Do
If fp > Len(Filter ) Then CompareFileName = np > len(name ): Exit Function
If Mid(Filter,fp ) = ".*" Then ' special case: ".*" at end of filter
If np > Len(Name ) Then CompareFileName = True: Exit Function
End If
If Mid(Filter,fp ) = "." Then ' special case: "." at end of filter
CompareFileName = np > Len(Name ): Exit Function
End If
Dim fc: fc = Mid(Filter,fp,1 ): fp = fp + 1
Select Case fc
Case "*"
CompareFileName = CompareFileName2(name,np,filter,fp )
Exit Function
Case "?"
If np <= Len(Name ) And Mid(Name,np,1 ) <> "." Then np = np + 1
Case Else
If np > Len(Name ) Then Exit Function
Dim nc: nc = Mid(Name,np,1 ): np = np + 1
If Strcomp(fc,nc,vbTextCompare )<>0 Then Exit Function
End Select
Loop
End Function

Private Function CompareFileName2 (ByVal Name, ByVal np0, ByVal Filter, ByVal fp0 )
Dim fp: fp = fp0
Dim fc2
Do ' skip over "*" and "?" characters in filter
If fp > Len(Filter ) Then CompareFileName2 = True: Exit Function
fc2 = Mid(Filter,fp,1 ): fp = fp + 1
If fc2 <> "*" And fc2 <> "?" Then Exit Do
Loop
If fc2 = "." Then
If Mid(Filter,fp ) = "*" Then ' special case: ".*" at end of filter
CompareFileName2 = True: Exit Function
End If
If fp > Len(Filter ) Then ' special case: "." at end of filter
CompareFileName2 = InStr(np0,Name,"." ) = 0: Exit Function
End If
End If
Dim np
For np = np0 To Len(Name )
Dim nc: nc = Mid(Name,np,1 )
If StrComp(fc2,nc,vbTextCompare )=0 Then
If CompareFileName(Mid(Name,np+1 ),Mid(Filter,fp ) ) Then
CompareFileName2 = True: Exit Function
End If
End If
Next
CompareFileName2 = False
End Function


then execute:

Code:


cscript fix_linefeed.vbs


and the problem is gone.

PS: No harm is done, if you run multiple times the script.
PRO
Synthiam
#13  
new plugin is updated to work now without being affected by line feeds
PRO
USA
#14  
Thanks, really important this works in my meeting.
United Kingdom
#15  
Thanks for finding the error ptp and for the update DJ.

There is something about updating the AIMLBot plug in that people should be aware of.... after the hours and hours of AIML file editing I have put in to my project over the past couple of weeks, updating the plug in has now replaced all of my edited Config settings and more to the point, ALL of my edited AIML files with the default files, so all my changes have now been over written and lost and I will have to start again from scratch. *mad*

So if like me you have spent a looong time editing to make lots of changes to personalise your AIML files... make sure you do a back up of your edited AIML and Config folders before carrying out any future AIMLBot plug in updates until a solution is found, so you don't lose all of your work.
#16  
@DJ, if we update AIML files in the plugin folder, will plugin updates blow out our file edits? Or potentially blow them out?

Which I guess after reading SteveG last post, actually relates to his post.
PRO
Synthiam
#17  
Yes it’ll overwrite. I’ll think of a solution
#18  
@DJ, thank you! I don't say it often enough, but you are awesome! The tools you've brought to the community are amazing! And AIMLBot was a fantastic idea, thank you, thank you for doing that DJ!
PRO
USA
#19  
I had same issue. But now working on a complete copies of the files in case it happens again. Maybe its opening and pointing the plug to the folder of aiml files you want to use. For me I have one set for ALAN and one set for Alena and a set of unaltered originals.
#20  
Can you use aimlbot fully offline with speech recognition?
PRO
Synthiam
#21  
Not without entering a lot of pre determined phrases. I can modify it to use the internal speech recognition engine without pre defined phrases, but accuracy is terrible lol
#22  
@dj Sures
    Being able to have a robot offline (like in a public place with no internet) and still able to understand (built-in or using your plugin) and respond (AIML) would be awesome. Sorry @fxrtst not trying to hijack your thread. :):)
#23   — Edited
I'd second that. Even with poor accuracy it would be nice to have as a backup if you are someplace with no internet and bad cell reception.