Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write an Eliza program in Python3. The program should be called eliza.py, and it should run from the command line with no arguments. Your program

Write an Eliza program in Python3. The program should be called eliza.py, and it should run from the command line with no arguments.

Your program should engage in a dialogue with the user, with your program Eliza playing the role of a psychotherapist. Your program should be able carry out "word spotting", that is it should recognize certain key words and respond simply based on that word being present in the input. It should also be able to transform certain simple sentence forms from statements (from the user) into questions (that Eliza will ask). Also, try to personalize the dialogue by asking and using the user's name.

Here's the start of an example dialogue...

eliza.py

-> [eliza] Hi, I'm a psychotherapist. What is your name?

=> [user] My name is Bridget.

-> [eliza] Hi Bridget. How can I help you today?

=> [Bridget] I want to rule the world.

-> [eliza] Bridget, why do you want to rule the world? [transform statement into ?]

=> [Bridget] I don't know, I think I crave power.

-> [eliza] Why don't you tell me more about your cravings. [word spot "crave" and respond.]

=> [Bridget] ...

Your program should be robust. If the user inputs gibberish or a very complicated question, Eliza should respond in some plausible way (I didn't quite understand, can you say that another way, etc.)

This program should rely heavily on the use of regular expressions, so please make sure to review some introductory material in Python, or some other source before attempting this program.

Eliza examples:

  • start emacs and run "M-x doctor"
  • eliza on the web
  • another eliza on the web

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions