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

PyAIML Tutorial
 
 

Hello everyone i have collected some information about PyAIML interpreter and i want to publish it in this topic as a tutorial.PyAIML is an interpreter is an program that you install it on your main Python interpreter and use it to test your chatbot but it doesnt supports <learn> and <eval> tags(maybe in later versions) so its only useful for beginners(like me)but its fast and simple now lets start the tutorial things that you need would be these :
1-Python 27(other versions may not work)
2-PyAIML installation File
===========================================================
now the installation :

1-right click and select “Run as administrator”
2-do the installation but select Python 27
===========================================================
now the tutorial :

1-open up cmd then write “python” and hit entere now you are in the python enviroment

2-in the python enviroment write “import aiml”(if you got an error try again twice until python goes to the next line without error)

3-now you must make your bot(in the python not in the AIML file)write"bot=aiml.Kernel()” and hit enter

4-now you must Upload your AIML file to your bots brain for doing that write “bot.learn(“your AIML file.aiml”)you can also use .xml aiml files

5-to test and chat with your bot there are two methods and i let you to choose the method that you think its right :
{
1-you can chat with your bot by using "respond" function in PyAIML to do that write "bot.respond("your text") but every time that you want to chat with your bot you most write all of that

2-the second way and the best way is to enter an infinite Loop to do chat with your bot to do that write "while True: print bot.respond(raw_input("=> "))
}

the end
===========================================================
aditionall tutorial

now that you have tested your bot and you see your bot works correctly,you may want to save your bots brain so you dont have to load your AIML file again to do that :

1-we create a new bot(you dont have to create a new bot) to do that write “secondbot=aiml.Kernel()”

2-now load your AIML file into your bots brain to do that write “secondbot.learn(“yourAIMLfile.aiml”)

3-now to save your bots brain write “secondbot.saveBrain(“yourbrain.brn”)

4-now we assume that you have created a new bot called “thirdbot” to load the “secondbot” brain into the “thirdbot” you must write “thirdbot.loadBrain(“yourbrain.brn”)
===========================================================
how to do SOMETHING FUNNY with PYAIML

to do something funny with pyAIML follow these steps :

1-download Mr Worswicks “Learn.aiml” file(this is a not clickable link you must copy paste it in url bar “http://www.square-bear.co.uk/aiml/”) this is a link—->

2-first copy the learn.aiml file into your python27 folder then write :

import aiml
funnybot=aiml.Kernel()
funnybot.learn(“learn.aiml”)
funnybot.respond(“learn that pyaiml is funny”)

3-hit enter


4-see the MAGIC cool smile

===========================================================
points

*you must copy your AIML file to your main Python interpreter Directory so PyAIML can find it otherwise you wont get any respond from your bot in PyAIML

*you must have Python27 interpreter installed on your PC to use PyAIML

*PyAIML does not supports some AIML tags like <learn> and <eval> tags so its only useful to beginners

===========================================================

resources :

http://www.stackoverflow.com
http://www.pyaiml.sourceforge.com
http://www.square-bear.co.uk/aiml

(){}[](){}[](){}[](){}[](){}[]
<======THE END=======>
(){}[](){}[](){}[](){}[](){}[]


Learn.aiml and some other AIML files

 

 
  login or register to react
‹‹ chatbots capability      Zipfs Law ››