Module: RubyLabs::ElizaLab

Includes:
Readline
Defined in:
lib/elizalab.rb

Overview

ElizaLab

The ElizaLab module has definitions of classes and methods used in the projects for Chapter 10 of Explorations in Computing. The methods and classes in this module are a Ruby implementation of Joseph Weizenbaum’s ELIZA program. Users can “chat” with the Doctor script, which mimics a Rogerian psychiatrist, and experiment by adding new rules to Doctor or writing their own scripts.

Most methods used to install a script or carry on a conversation are in a module named Eliza.

To interact with Eliza, call one of the class methods, e.g. to load the “doctor” script that comes with the ElizaLab module call Eliza.load(:doctor) and to start a conversation call Eliza.run. See the documentation for the Eliza module for a complete list of these top level methods.

Defined Under Namespace

Classes: Dictionary, Eliza, Pattern, Rule

Constant Summary collapse

@@verbose =

These state variables are accessible by any methods in a class defined inside the ElizaLab module

false
@@elizaDirectory =
File.join(File.dirname(__FILE__), '..', 'data', 'eliza')
@@pre =
Dictionary.new
@@post =
Dictionary.new
@@rules =
Dictionary.new
@@word =

pattern for a “word” in the input language

/[a-z\-$']+/i
@@iword =

same, but must be the first item on the line

/^[a-z\-$']+/i
@@var =

variable name in reassembly string

/\$\d+/