designing a chatbot
DESCRIPTION
Designing a Chatbot. Using ALICE, AIML, and Pandorbots.com Kamal Aboul-Hosn Cornell University. How Does ALICE Work?. Implements AIML Artificial Intelligence Modeling Language Engine controls interface with person Languages: Java, PHP, Lisp... Allows for webpage, instant messenger, etc. - PowerPoint PPT PresentationTRANSCRIPT
Using ALICE, AIML, and Pandorbots.comKamal Aboul-HosnCornell University
Designing a Chatbot
Implements AIML
Artificial Intelligence Modeling Language
Engine controls interface with person
Languages: Java, PHP, Lisp...
Allows for webpage, instant messenger, etc.
How Does ALICE Work?
“Pattern Matches” against user input
Removes punctuation and capitalization
Compares what user types to library of expected statements
Replies based on matching pattern
Replies can be dynamic based on input
How Does ALICE Work?
Example AIML Code<category>
<pattern>HELLO</pattern><template><random> <li>Well hello there!</li> <li>Hi there!</li> <li>Oh, hello again!</li></random></template>
</category>
The Basics of AIML
Category - basic unit of knowledge
Input - <pattern>...</pattern>
Output - <template>...</template>
Possibly a context - <that>...</that>
The bot likely responds to “Hello” and “Hi” the same way.
Do we have to write the same code each time?
No, we don’t!
Tell the bot to look recursively at the responses to give for another input
Different Inputs,The Same Output
Recursion to the Rescue
<category><pattern>HI</pattern><template><srai>HELLO</srai></template>
</category>
<category><pattern>HEY THERE</pattern><template><srai>HELLO</srai></template>
</category>
Combining Recurive Calls
<category><pattern>HI HOW ARE YOU</pattern><template><srai>HELLO</srai>
<srai>HOW ARE YOU</srai></template>
</category>
Limitations
ALICE has no concept of “language”
Would understanding grammar help?
English is an ambiguous language
“Time flies like an arrow.”
“Fruit flies like a banana.”
Consider two pieces of conversation:
Bot: Is it raining outside?User: Yes.
Bot: Is it sunny outside?User: Yes.
What is wrong with<category>
<pattern>YES</pattern>...?
Maintaining Context
Need a context to which the “yes” refers
Can use the bot’s last statement
Maintaining Context
<category><pattern>YES</pattern><that>IS IT RAINING OUTSIDE</that><template>As long as it doesn’t storm.</template>
</category>
<category><pattern>YES</pattern><that>IS IT SUNNY OUTSIDE</that><template>We should go to the beach!</template>
</category>
How do we accept any user input?
Do not want a pattern for every possible phrase
Use the * and <star/> commands
Matching Generic Phrases
<category><pattern>YOU ARE *</pattern><template>Why do you say I am <star/>?</template>
</category>
Go to http://www.pandorabots.com
Click to create a new account
Fill in information
Log into the system
Click on “Create a new bot”
Using PandoraBots
Creating a New Bot
Give the bot a name
Select a Startup AIML set
Either of the two sets is fine
For a challenge, start with no knowledge
Creating a New Bot
Editing Bot Properties
Editing Bot Properties
Fill in any information you want for your bot
Click on “Set Bot Properties”
To train, click “Build and run this bot”
Training the Bot
Training the BotCarry on a conversation with the bot
The current topic is listed
If the response is bad, can alter the reply in two ways
Type in new response next to “Say This Instead” and click button
Click on “Advanced Alter Response”
Teaching the Bot
Teaching the Bot
Type in a new response under “template”
Can contain AIML code as listed
Use the buttons to select code templates
Can make response based on “that” or “topic”
Click on “Submit” to make changes
Click on “Publish this bot” to make bot available for everyone online