Git Product home page Git Product logo

chatbot-simple's Introduction

NAME

ChatBot::Simple - a new and flexible chatbot engine in Perl.

DESCRIPTION

ChatBot::Simple is a flexible chatbot engine written in Perl.

Instead of specifying the chatbot knowledge base in xml, we are going to use the powerful text manipulation capabilities of Perl.

The rationale behind this decision is that "simple" AI languages, like AIML, are only simple if you want to do simple things. Once you start adding features, they quickly become unmanageable.

ChatBot::Simple's design goal is to make easy things easy, and difficult things possible.

FEATURES

Simple pattern/responses

pattern 'hello' => 'hi!';

Multiple (random) responses

pattern 'hello' => [ 'hi!', 'hello!', 'wazzzzup!' ];

Named parameters

pattern "my name is :name" => "hello, :name!";

Code execution

my %mem;

pattern "my name is :name" => sub {
	my ($str,$param) = @_;

	$mem{name} = $param->':name';

	return;
} => "nice to meet you, :name!";

Multiple named parameters

my %var;

pattern "define :variable as :value" => sub {
	my ($str,$param) = @_;

	my $variable = $param->{':variable'};
	my $value    = $param->{':value'};

	$var{$variable} = $value;

	return;
} => 'ok';

Regular expressions

pattern qr{what is (\d+) ([+-/*]) (\d+)} => sub {
	my ($str,$param) = @_;

	my ($n1,$op,$n2) = ($param->{1}, $param->{2}, $param->{3});
	# ...

	return $result;
};

Transformations

Transformations can be used to normalize input, and are performed before the pattern matching:

transform "I'm"    => "I am"
transform "you're" => "you are";
transform "what's" => "what is";

They can use parameters as well:

transform "I am called :name" => "my name is :name";

(See more examples in the "t/" directory.)

INSTALLATION

To install this module, run the following commands:

perl Makefile.PL
make
make test
make install

SUPPORT AND DOCUMENTATION

After installing, you can find documentation for this module with the perldoc command.

perldoc ChatBot::Simple

Send comments, suggestions and bug reports to:

https://github.com/nferraz/ChatBot-Simple/issues

Or fork the code on github:

https://github.com/nferraz/st

LICENSE AND COPYRIGHT

Copyright (C) 2013 Nelson Ferraz

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

chatbot-simple's People

Contributors

nferraz avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.