CSCI 150 - Foundations of Computer Science

Fall 2013

Project 3: Chatterbot


Chatterbots

A chatterbot is a program that simulates a conversation with a human user. It relies upon vague statements to create an illusion of an intelligent conversation. It looks for patterns and critical words in user inputs to formulate plausible-sounding responses.

The earliest chatterbot program was called ELIZA. It simulated a Rogerian psychotherapist. Here is an example of a conversation between the instructor and his own simple implementation of ELIZA:

>>> chat(10)
I am Eliza.  How can I help you?
> I am tired.
Why do you feel tired?
> It is late at night.
Tell me more about tired.
> I get tired when it is late at night after a lot of work.
Why do you feel tired?
> Why do you keep asking?
I don't have answers; I give you questions to help you find your own answers.
> I'm sorry.
Tell me more about tired.
> I have too much to do.
Tell me more.
> It is satisfying to finish lots of work.
Why do you find that to be satisfying?
> I feel like I can make my father proud.
Tell me more about your relationship with your father.
> He always pushed me to do my best.
Tell me more about satisfying.
> It is very satisfying to do my best work.
Why do you find that to be satisfying?
> It is a feeling of fulfillment.
Thank you for chatting.  Have a nice day.
>>> 

The Project

The skeleton file for the project contains the following:
greeting = "I am Eliza.  How can I help you?"

def chat(n):
    print(greeting)
    for i in range(n):
        print(reply(input("> ")))
    input("> ")
    print("So long for now.  Have a nice day.")

def reply(sentence):
    return "Reply"
Your task is to rewrite the reply() function to have a distinct personality. Each call to reply() will generate one answer to one user sentence. Also, modify greeting to be consistent with your program's character. Here are the requirements: