Some ideas for making the Magpie chatbot “smarter:”
- Add more keywords that can be recognized. To do that, edit the Magpie class (not the Magpie runner class) and add an additional “else if” block with a different keyword to look for. Inside the curly braces, return a string that matches the keyword topic.
- Convert the statement from the user to lower case to make it work even if they include capital letters.
- Create a response that is used when a certain combination of two words is found in the user’s statement. Use the && (“and”) operator in your else if condition.
- Create a second method in the Magpie class – use the getResponse() method as a tempalte (copy and paste and modify), using a different method name such as moviesResponse(). Then you can setup a system that uses the regular getResponse() method to create a general response, but instead use moviesResponse() to make a response to a movie question.
- Store the last TWO statements by the user (needs two separate String variables). Then if the user says the same thing twice in a row, have the chatbot tell the user to say something new.
- Have the chatbot say “Is there an echo in here?” if the user is copying what the chatbot says.
- Have the chatbot quit after a certain number of statements by the user. (Use a variable to keep track of how many statements they’ve entered).
- Harder task: make the chatbot go into a new sub conversation if certain topics are brought up. For example, if the user asks about food, use a different magpie object instance and a different type of getResponse() method to process those statements until the food topic is finished.