AI Zone Admin Forum Add your forum

NEWS: Chatbots.org survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

Match failure after setting topic
 
 

Hi all,
I am using Program-AB to run my bot.
I have an AIML file that has two topics definitions and how to
I have a category that refers to a set of question words like what, why etc. When a question word is detected in input to my bot,  the topic changes to definitions
however, the bot fails to find the definition the user has asked for.
Suppose the input is:
what is an algorithm
I can see that the questionwords set is being used and the topic is being set to definitions. However, there is a category defined with this input that is, I have a pattern that has the text
what is an algorithm and the template has an answer to this question. This answer is not shown because once the topic has been set, the bot does not do anything.
If I remove topics from the AIML file, things work as expected.

What am I doing wrong?
Pranav

 

 
  [ # 1 ]

Without seeing the AIML categories in question, it’s very difficult to guess at what the problem is. Could you provide the AIML file in question, so that it could be examined? It could be attached here, provided the .aiml extension got changed to a .txt extension, OR you could place the contents of the file into PasteBin and post a link here. Either way will work.

 

 
  [ # 2 ]

Hi Dave,

Sure, I’ll try to attach the file here.
I am unable to attach the file. I keep getting the following error.

The file could not be written to disk.
Pranav

 

 
  [ # 3 ]

Interesting. In that case, I recommend opening the AIML file that’s causing the issue in a text editor, copy the contents to the clipboard, go to https://pastbin.com and creating a new “paste” there, then posting the link to it here.

 

 
  [ # 4 ]

Hi Dave,
Grab the file from

https://1drv.ms/u/s!Av4xM5kDQMVbenZKxllE08NaLyU

I appear to be unable to access pastbin. It could be something temporary so Microsoft one drive should do in the mean time. <smile

[edit]Link fixed, I hope).[/edit]

 

 
  [ # 5 ]

It seems that the AIML gods are displeased, since that link results in a “Page not found” error. How about if you email me at dmorton(at)geekcavecreations(dot)com and send me the file as an attachment? I’ll look at it and see what I can see.

[edit]

Ok, I see the problem here. It seems that the forum software doesn’t like the exclamation point in the URL, so simply left it out. I’ll post a bit.ly link shortly that will “fix” the problem.

[/edit]

 

 
  [ # 6 ]

After having seen the file, I understand why it’s not working as expected. The syntax for the <topic> tag in that file is all wrong, I’m afraid. What you have, for example, is this:

<category>
  <
pattern>*</pattern>
  <
topic>definitions</topic><!-- This is not where this tag belongs -->
  <
template>
    <
think><set name="topic"></set></think>
      
unknown
  
</template>
</
category

when it should look like this:

<topic name="definitions"><!-- This is how the TOPIC tag should look -->
  <
category>
    <
pattern>*</pattern>
    <
template>
      <
think><set name="topic"></set></think>
        
unknown
    
</template>
  </
category>
</
topic><!-- End of the TOPIC tag --> 

Please note how the <topic> tag contains the category, instead of the other way around. The <topic> tag is a container for all AIML categories within the topic it describes (given by the name attribute).

I’m in the middle of another bit of work, but if you like, I can re-write the AIML file to be semantically correct. It just may take me a bit of time to get it completed.

 

 
  [ # 7 ]

I took the time to refactor the code to fix the topic issue, but while doing so I noticed that there are a lot of AIML categories that need some attention as well. since you’re using Program AB, many of the categories that you have that SRAI to FILTER PROFANITY or FILTER INAPPROPRIATE could be structured using the “zero+” wildcards (e.g. $ and ^) instead of the “one+” versions (_ and *). This could eliminate a lot of repetition in the code, and simplify the file substantially. That sort of repair is beyond the scope of my intentions, so I think I’ll just make you aware of the situation (which I have. raspberry) and leave it up to you to implement any changes in that area that you deem appropriate.

File Attachments
ciso_test.aiml.txt  (File Size: 75KB - Downloads: 67)
 

 
  [ # 8 ]

Hi Dave,
1. Many many thanks for fixing the topic tag. I am rather confused about it. My understand from reading the documents on AIML 2.0 was that the category contains the topic. In AIML 1.x, the topic contained the category.
2. As for the insults and profanity section, I was thinking of moving all of them out of the AIML and into a set which may simplify things even further.

 

 
  [ # 9 ]

Hi Dave,
I have been testing the file and am not getting any answers. The bot is setting the correct topics but none of the patterns in the topic are being matched after that. Are multiple occurrences of the topic tag the problem? For example,,
<topic name=“definitions>
we have some categories
</topic>
This is at the beginning of the file.
In the middle of the file, once again,
we have
<topic name=“definitions>
we have some categories
</topic>

 

 
  [ # 10 ]

No, you can have as many sets of identical topic tags as you want/need. I’m only passingly familiar with Program AB, so I’m not familiar with any logging/debugging functionality that it may have. Let me test the file in Program O, which has substantial functionality for debugging responses. Once I test the file, I’ll post my results here.

 

 
  [ # 11 ]

Well, THAT didn’t work. I hadn’t realised that the AIML file in question uses AIML 2.0 <set> tags within the <pattern>, and as such, can’t be tested within the current version of Program O, and the newest version isn’t far enough along just yet to be able to test it properly, so aside from doing a manual analysis, there’s not much I can to with it. I’m sorry, Pranav, but I don’t see anything out of the ordinary with the file itself. The only other thing that might make sense is if the files for the <set> tags weren’t located in the correct folder, or just don’t exist. You DO have the set files in place, don’t you?

 

 
  [ # 12 ]

Hi all,
I am back and have found something rather interesting.
Suppose I ask my bot a question
what is cyber security
It sets the topic in the first go. If I repeat the question, it displays the answer to that question. I have no idea why this is happening. I have simplified the AIML file by removing the insults section and moving the categories under their own topics.
My set files are in the same place.
By the way, the way I figured out this was happening was that I ran my bot using program-ab’s terminal functionality. I was able to see what was happening.

I am unable to attach the file. I have used pastebin. The link is below.
http://pastebin.com/6NLCGY63

 

 
  [ # 13 ]

Hi all,
Sorry about replying to my own post. I removed the <think> tag from my code and can better see what is happening. When I first ask a question like what is cyber security the bot sets the topic to definitions. However, it does not go any further. Once the topic is set, I then have to ask it the same   question again and that is when it will answer my question. How do I get around this?

 

 
  login or register to react