Skip to content

A Ruby implementation ELIZA, your friendly neighborhood robo Rogerian psychotherapist.

License

Notifications You must be signed in to change notification settings

tansengming/eliza-rb

Folders and files

NameName
Last commit message
Last commit date
Oct 18, 2016
Oct 30, 2016
Feb 28, 2017
Oct 14, 2016
Oct 13, 2016
Oct 17, 2016
Oct 14, 2016
Feb 28, 2017
Oct 13, 2016
Feb 28, 2017
Oct 13, 2016
Feb 28, 2017
Oct 18, 2016
Feb 28, 2017
Feb 28, 2017

Repository files navigation

Code Climate Test Coverage

ELIZA-rb

A Ruby implementation Joseph Weizenbaum's ELIZA, your friendly neighborhood robo Rogerian psychotherapist.

This is a work in progress. The rules needs a bit more work before it's ready for 1.0. In the meantime have fun and let me know how it goes.

This is what it looks like chatting with her,

ELIZA: Please tell me what's been bothering you.
I have problems sleeping every night. 
ELIZA: That's quite interesting.
It's not really interesting. More bothersome than anything. 
ELIZA: What does that suggest to you?
I think it means that I've been having bad dreams. 
ELIZA: You say you think it means that you've been having bad dreams?
Yes, exactly. 
ELIZA: I understand.
But how can you? You're a computer!
ELIZA: What about machines worries you?

Getting Started

Installing

TBD

Usage

eliza   = Eliza::Bot.new
initial = eliza.initial_phrase
reply   = eliza.transform(input_string)

 # `#transform` returns a final phrase in case of a quit phrase
 # but you can also get a final phrase with:
 final  = eliza.final_phrase

Command Line Interface

You can chat with ELIZA on the CLI by running:

./bin/eliza-rb

Docker

If you already have Docker installed, here's how you can get started:

  • docker build -t eliza-rb github.com/tansengming/eliza-rb
  • docker run -it eliza-rb

Development

Approach

ELIZA works by matching keywords and using those keywords to form replies with a bunch of rules:

Let's say forget is a keyword with decomposition and reassembly rules that look like this:

{
  decomposition_pattern: "* i forget *"
  reassembly_pattern: Can you think of why you might forget \2?
}

If we start off with a sentence like:

What if I forget about the kettle?

Applying the rules would create this reply:

Can you think of why you might forget about the kettle?

References

About

A Ruby implementation ELIZA, your friendly neighborhood robo Rogerian psychotherapist.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published