Download presentation
Presentation is loading. Please wait.
Published byJean-Pascal Martineau Modified over 6 years ago
1
AP Magpie Chatbox "If a computer could think, how could we tell?"
Alan Turing's suggestion was, that “if the responses from the computer were indistinguishable from that of a human, the computer could be said to be thinking. “ This field is generally known as natural language processing.
2
Getting Started ( 5 minutes)
From the class website open and read over the document. magpie_lab_student_guide_updated_sept_2014.pdf
3
Learning Objectives Students will be able to create a Chatbot that employs artificial intelligence.
4
A couple of useful String Methods
int x = stringVar.indexOf(“Hello”); Finds the index of the first occurrence of “Hello” in the String stringVar. Returns -1 if no “Hello” String chop = stringVar.trim(); Returns a copy of the string stored in stringVar with leading and trailing spaces deleted.
5
Note: 3 Spaces before ‘Hello’
Example: Dry Run Note: 3 Spaces before ‘Hello’
6
The Loebner Prize in Artificial Intelligence
Dr. Loebner pledged a Grand Prize of $100,000 and a Gold Medal (pictured above) for the first computer whose responses were indistinguishable from a human's.
7
Activity 1: Hands On (10 – 15 minutes)
Experiment with the different Chatbots. Look for how they respond and how you might incorporated this into your Chat bot • How does it respond to “where do you come from”? • What is the most interesting response? • What is the most peculiar response? • How does it respond to “asdfghjkl;”? Can you identify keywords to which your chatbot responds? (Record on your worksheet) Think of several keywords and the responses they might cause. (Record on your worksheet) Work with another group and have two different chatbots converse with each other.
8
Chatbots
9
Breaking Down a Chatbot
Create a folder in your APJava folder called Magpie Project Go to the Assignments\MagpieProject folder and copy ‘activity2’ folder into your Magpie Project folder. Additional parts of this project will be added to the folder as you continue with the project.
10
Open Magpie2 and MagpieRunner2
Read over the code Magpie2 Constructor Methods What is sent to them? What is returned? MagpieRunner2 What does it do to start? What do you have to enter to quit?
11
Activity 2: Modify the Chatbot
Turn it in as YourNamesChatbot2 • Have it respond “Tell me more about your pets” when the statement contains the word “dog” or “cat.” For example, a possible statement and response would be: Statement: I like my cat Mittens. Response: Tell me more about your pets. • Have it respond favorably when it sees the name of your teacher. Be sure to use appropriate pronouns! For example, a possible statement and response would be: Statement: Mr. Finkelstein is telling us about robotics. Response: He sounds like a good teacher. • Have the code check that the statement has at least one character. You can do this by using the trim method to remove spaces from the beginning and end, and then checking the length of the trimmed string. If there are no characters, the response should tell the user to enter something. For example, a possible statement and response would be: Statement: Response: Say something, please. • Add two more noncommittal responses to the possible random responses. • Pick three more keywords, such as “no” and “brother” and edit the getResponse method to respond to each of these. Enter the three keywords and responses below.
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.