Last updated:
0 purchases
eliza chat
Eliza chat is a dart implementation of the ELIZA chatbot designed by Joseph Weizenbaum, in the sixties. ELIZA was one of the first chatbots that ever existed. This is a tribute to that wonderfull work that was well ahead of its time. The code for this package is based on the python version created by Wade Brainerd (https://github.com/wadetb/eliza)
Features #
Eliza can be used to implement in a fun Dart or Flutter project.
Getting started #
Install the package, import the library and you're good to go.
Usage #
import 'dart:io';
import 'package:eliza_chat/eliza_chat.dart';
void main() {
var eliza = Eliza();
print(eliza.getHeader());
print(eliza.getInitial());
while (true) {
stdout.write("You: ");
var input = stdin.readLineSync();
if (input == null) {
break;
}
var output = eliza.processInput(input);
if (output == null) {
break;
}
print("Eliza: $output");
}
print(eliza.getFinal());
}
copied to clipboard
Additional information #
To start using the package, create an instance of the Eliza class
var eliza = Eliza();
copied to clipboard
To get the old school header from the original ELIZA, use the getHeader() method. This method returns a String value:
eliza.getHeader();
copied to clipboard
To get the introduction text from ELIZA, use the getInitial() method. This method returns a String value:
eliza.getInitial();
copied to clipboard
To process the user its question, use the processInput() method. This method returns a String? value:
eliza.processInput(input);
copied to clipboard
processInput() CAN return a null value. If the user types "bye", "goodbye" or "quit", Eliza knows you want to terminate the conversation and will return a null value instead. By checking for a null value you can get confirmation that Eliza received the stop command and you get ask for a final sentence. The getFinal method returns a String value:
eliza.getFinal();
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.