AP Java Enhancing the Chatbot. Natural Language Processing Note: What is Natural Language Processing? What are some of the opportunities? What are some.

Slides:



Advertisements
Similar presentations
COMP 121 Week 9: AbstractList and ArrayList. Objectives List common operations and properties of Lists as distinct from Collections Extend the AbstractCollection.
Advertisements

String Processing Word processing term papers, writing memoirs, sending messages, responding to surveys, placing online orders and registering.
Chapter 1 Object-Oriented Concepts. A class consists of variables called fields together with functions called methods that act on those fields.
PIIT Computer Science Summer Camp - Alice July 10, 2012 Brenda Parker Computer Science Department MTSU.
Computer Science 1620 Programming & Problem Solving.
The If/Else Statement, Boolean Flags, and Menus Page 180
Games and Simulations O-O Programming in Java The Walker School
CH1 – A 1 st Program Using C#. Program Set of instructions which tell a computer what to do. Machine Language Basic language computers use to control.
Week 4-5 Java Programming. Loops What is a loop? Loop is code that repeats itself a certain number of times There are two types of loops: For loop Used.
Working with Numbers in Alice - Converting to integers and to strings - Rounding numbers. - Truncating Numbers Samantha Huerta under the direction of Professor.
by Chris Brown under Prof. Susan Rodger Duke University June 2012
THE BIG PICTURE. How does JavaScript interact with the browser?
Go to your school’s web locker site school name.schoolweblockers.com) Your user name is the first letter of your first name, the first four.
Welcome to Mr. Knight’s Language Arts Class! Sit Where You Like For Now.
By the end of this session you should be able to...
CSD 340 (Blum)1 Ifs. CSD 340 (Blum)2 Page that asks user for background color and changes fore color from black if user selects black as background color.
VB Games: Preparing for Memory Brainstorm controls & events Parallel structures (again), Visibility, LoadPicture, User-defined procedures, Do While/Loop,busy.
What did the teacher say? Please pay _______. attention.
Warm-Up: Monday, March 24 List as many commands in Java as you can remember (at least 10)
3/31/10. Electromagnet Fishing Derby 2010 Take out your project worksheet and complete the top section of STEP 6.
Communication Skills. Skills that help a person share thoughts, feelings and information with others. There are several different ways to communicate.
Go to your school’s web locker site Your user name is the first letter of your first name, the first four letters of.
Computer Science 111 Fundamentals of Programming I Dictionaries redux.
1 Lesson Three. 2 Opening a Document Inserting Text Deleting a Character Deleting a Word Deleting a Sentence Automatic Braille Advance.
1 Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
Creating Programs on UNIX This term you can create programs on UNIX or you can create programs using a C++ compiler on your PC. This set of slides steps.
1 Lesson Four. 2 The Spelling Checker Searching for Text Menu shortcuts Printing a File Erasing a File.
Monday.
Make a dice challenge! This is a starter activity and should take 5 minutes [ slide 1 ] 1.Log in to your computer 2.Open IDLE 3.Copy the code below in.
My Python Programmes NAME:.
M1G Introduction to Programming 2 3. Creating Classes: Room and Item.
Introduction to Computer Programming - Project 2 Intro to Digital Technology.
Creating and Using Class Methods. Definition Class Object.
Written by: Dr. JJ Shepherd
1 Project 3 String Methods. Project 3: String Methods Write a program to do the following string manipulations: Prompt the user to enter a phrase and.
PHP Form Processing * referenced from
Special Methods in Java. Mathematical methods The Math library is extensive, has many methods that you can call to aid you in your programming. Math.pow(double.
1 Project 7: Looping. Project 7 For this project you will produce two Java programs. The requirements for each program will be described separately on.
M1G Introduction to Programming 2 2. Creating Classes: Game and Player.
AP Java Java’s version of Repeat until.
Adding and Eating Worms Mrs. C. Furman August 23, 2010.
How can I make sure my persuasive essay is memorable?
WHAT IS A CHATTERBOT? A chatterbot is a computer program that simulates a conversation between two people. That is, one person writes something and the.
Today Javadoc. Packages and static import. Viewing API source code. Upcoming Topics: –protected access modifier –Using the debugger in Eclipse –JUnit testing.
Learning to use a ‘For Loop’ and a ‘Variable’. Learning Objective To use a ‘For’ loop to build shapes within your program Use a variable to detect input.
Monday. In 2-3 sentences, explain what you think this quote means… “Before I can walk in another’s shoes, I must first remove my own.”
© A+ Computer Science - Magpie Magpie is a lab that focuses on classes, randomness, and Strings. This lab will make sure that you.
Section 6.1 Introduction to String Methods. Section 6.1 Introduction to String Methods.
AP Java Elevens Lab.
Mrs. Bates’ Classroom Procedures and Expectations
AP Java Enhancing the Chatbot.
© A+ Computer Science - Magpie Chatbot Lab © A+ Computer Science -
Week of 12/12/16 Test Review.
Warm-up Program Use the same method as your first fortune cookie project and write a program that reads in a string from the user and, at random, will.
Working with Text and Numbers in Java
Computer Science 2 Hashing
CIS16 Application Development and Programming using Visual Basic.net
AP Magpie Chatbox "If a computer could think, how could we tell?"
Giving and Receiving Compliments
Introduction to TouchDevelop
“Day B” January 8, :01 - 9:01 Exploratory 9: :03
AP Java Enhancing the Chatbot.
Python 19 Mr. Husch.
Jeff West - Quiz Section 9
Building a Game in Scratch
Magpie/Chatbot Activity 5
Python 19 Mr. Husch.
Presentation transcript:

AP Java Enhancing the Chatbot

Natural Language Processing Note: What is Natural Language Processing? What are some of the opportunities? What are some of the challenges?

Leaning Objectives Take a look at Natural Language Processing and some of its’ challenges and opportunities. Be able to use Java Docs to look up and use additional String methods. Practice reading a program that uses String methods in developing a Chatbot Enhance your Chatbot

Use Javadocs to look up the following String Methods Summarize the following String methods in your notes. indexOf (String) indexOf(String, int) toLowerCase(String) trim(String)

private int findKeyword(String statement, String goal, int startPos) { String phrase = statement.trim().toLowerCase(); goal = goal.toLowerCase(); int psn = phrase.indexOf(goal, startPos); while (psn >= 0) { String before = " ", after = " "; if (psn > 0) { before = phrase.substring(psn - 1, psn); } if (psn + goal.length() < phrase.length()) { after = phrase.substring(psn + goal.length(), psn + goal.length() + 1); } /* determine the values of psn, before, and after at this point in the method. */ if (((before.compareTo ("a") 0)) && ((after.compareTo ("a") 0))) { return psn; } psn = phrase.indexOf(goal, psn + 1); } return -1; } findKeyword("She's my sister", "sister", 0); findKeyword("Brother Tom is helpful", "brother", 0); findKeyword("I can't catch wild cats.", "cat", 0); findKeyword("I know nothing about snow plows.", "no", 0); findKeyword("She's my sister", "sister", 0); findKeyword("Brother Tom is helpful", "brother", 0); findKeyword("I can't catch wild cats.", "cat", 0); findKeyword("I know nothing about snow plows.", "no", 0); Dry Run using the call statements on the bottom of the page.

Modifying the Magpie Copy the Activity3 Folder from the Magpie project into your Magpie Project folder Repeat the changes made to Magpie2 to the Magpie3 class.

Modify the Magpie3 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. Turn it in as YourNamesChatbot3

Questions: Prepare for the next activity Single keywords are interesting, but better chatbots look for groups of words. Consider statements like “I like cats,” “I like math class,” and “I like Spain.” All of these have the form “I like something.” The response could be “What do you like about something?” The next activity will expand on these groups. You will get to add one of your own, so it’s a good idea to start paying close attention to common phrases in your own conversations.

Chatbot Activity 4 Look at the code. See how it handles “I want to” and you/me statements. Have it respond to “I want something” statements with “Would you really be happy if you had something?” In doing this, you need to be careful about where you place the check. Be sure you understand why. For example: Statement: I want fried chicken. Response: Would you really be happy if you had fried chicken? Have it respond to statements of the form “I something you” with the restructuring “Why do you something me?” For example: Statement: I like you. Response: Why do you like me? Demonstrate your program(s) to Mr. Smith to get these programming exercises checked off

Watson Video

Chatty 5 Learning Objectives Be able to implement using an array to store and use random responses

Chatbot Activity 5 Use an array to store your set of random responses and replace the nested ifs with a more efficient way to show responses from the array Add four additional random responses. At the end of class your team will be demonstrating your Chatbot.