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..

Topic Tag is not working as expected
 
 

Hello again.

I am using the below AIML with python, but seems like the topic is not working as expected

even if the entered password 1234 is not matching for some reason bot would say “Sorry you entered wrong password”  Please help

<?xml version="1.0" encoding="ISO-8859-1"?>
<aiml>
    <
category>
      <
pattern>LET ME IN</pattern>
      <
template><think><set name="topic">PASSWORD</set></think>Whats the password</template>
    </
category>

    <
topic name="PASSWORD">
      <
category>
        <
pattern>1234</pattern>
        <
template>That is correct</template>
      </
category>
      <
category>
        <
pattern>*</pattern>
        <
template>
          <
think>
            <
set name="topic">PASSWORD</set>
          </
think>
          
Sorry you entered wrong password
        
</template>
      </
category>
   </
topic>
    <
category>
      <
pattern>*</pattern>
      <
template>
        
WellI don't understand!
      </template>
    </category>
  </aiml> 


Expected Conversation

HumanLet me in
Bot
Whats the password
Human
:1234
Bot
That is correct 


But I got the below one:

HumanLet me in
Bot
Whats the password
Human
:1234
Bot
WellI don't understand! 
 

 
  [ # 1 ]

You mentioned using AIML with python. Could you tell us, please, if this is something you’ve written, or is it a script that’s publicly available?

 

 
  [ # 2 ]

Thanks Dave

I am using Flask, Here is the base code I pulled in.

https://github.com/ibrahim4529/flask-chatbot/issues/2

 

 
  [ # 3 ]

Also,  I am using aiml 0.9.1 with both the version of python 2.7 and 3.6 as well. Am I using the right combination. Are there any newer version is available for aiml.

 

 
  [ # 4 ]

the latest version of AIML is 2.0, but it’s on a completely different level from earlier versions. For your purposes, AIML 1.01 would probably be most effective. there are SOME changes between 0.9 and 1.0.1, but not many, so you shouldn’t have much trouble with it.

 

 
  [ # 5 ]

Thanks.  Any one else what am I missing, why the bot is not getting into topic block.

import aiml
import os

kernel 
aiml.Kernel()

kernel.bootstrap(learnFiles os.path.abspath("aiml/test.xml"), commands "load aiml b")
kernel.saveBrain("test_bot_brain.brn")

while 
True:
    print (
kernel.respond(input("Enter your message >> "))) 


Here is my “test.aiml”

<?xml version="1.0" encoding="iso-8859-1"?>
<aiml version="1.0">
  <
category>
    <
pattern>HELLO</pattern>
    <
template>
      
Wellhello!
    </
template>
  </
category>
  <
category>
    <
pattern>WHAT ARE YOU</pattern>
    <
template>  I m a bot </template>
  </
category>

  <
category>
    <
pattern>LET ME IN</pattern>
    <
template>
      <
think>
        <
set name="topic">PASSWORD</set>
      </
think>Whats the password
    
</template>
  </
category>
  
  <
topic name="tree">
    <
category>
      <
pattern>1234</pattern>
      <
template>
        <
think>
          <
set name="topic">DEFAULT</set>
        </
think>Sucess
      
</template>
    </
category>
    <
category>
      <
pattern>*</pattern>
      <
template>
        <
think>
          <
set name="topic">PASSWORD</set>
        </
think>Sorry you entered wrong password
      
</template>
    </
category>
  </
topic>
  
  <
category>
    <
pattern>*</pattern>
    <
template>I am sorrydo not understand</template>
  </
category>

</
aiml

Here is my “test.xml”

<aiml version="1.0">
  <!-- 
This category works with the standard AIML Set -->
  <
category>
    <
pattern>LOAD AIML B</pattern>
    <
template>
      <
learn>aiml/test.aiml</learn>
    </
template>
  </
category>
</
aiml

 

 

 
  login or register to react