designing a chatbot

21
Using ALICE, AIML, and Pandorbots.com Kamal Aboul-Hosn Cornell University Designing a Chatbot

Upload: mckile

Post on 27-Jan-2016

116 views

Category:

Documents


6 download

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 Presentation

TRANSCRIPT

Page 1: Designing a Chatbot

Using ALICE, AIML, and Pandorbots.comKamal Aboul-HosnCornell University

Designing a Chatbot

Page 2: 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?

Page 3: Designing a Chatbot

“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?

Page 4: Designing a Chatbot

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>

Page 5: Designing a Chatbot

The Basics of AIML

Category - basic unit of knowledge

Input - <pattern>...</pattern>

Output - <template>...</template>

Possibly a context - <that>...</that>

Page 6: Designing a Chatbot

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

Page 7: Designing a Chatbot

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>

Page 8: Designing a Chatbot

Combining Recurive Calls

<category><pattern>HI HOW ARE YOU</pattern><template><srai>HELLO</srai>

<srai>HOW ARE YOU</srai></template>

</category>

Page 9: Designing a Chatbot

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

Page 10: Designing a Chatbot

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

Page 11: Designing a Chatbot

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>

Page 12: Designing a Chatbot

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>

Page 13: Designing a Chatbot

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

Page 14: Designing a Chatbot

Creating a New Bot

Page 15: Designing a Chatbot

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

Page 16: Designing a Chatbot

Editing Bot Properties

Page 17: Designing a Chatbot

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”

Page 18: Designing a Chatbot

Training the Bot

Page 19: Designing a Chatbot

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”

Page 20: Designing a Chatbot

Teaching the Bot

Page 21: Designing a Chatbot

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