Example of a simple chatterbot for educational purposes.
- Download package:
composer require tigo/chatterbot
- MIT license: License
- Feel free to use this project. Leave a star ⭐ if you liked!
If you found this project useful, consider making a donation to support the developer.
This project is based on question and answers. Example: a array with the following information
"Hi"=> ["Hi","Hello"]
Question = "Hi" | random answer = ["Hi","Hello"]
Using Database
Starting with composer
- Install composer
- Download package:
composer require tigo/chatterbot
- PHP >= 7.3;
- Update command:
composer update
//Somewhere in your project, you may need to use autoload
include __DIR__ ."/vendor/autoload.php";
Example
use Tigo\ChatterBot\Bot\BotUniversal; // import class
use Tigo\ChatterBot\Response; //import class
$response = new Response(new BotUniversal);
//using local array data | return string
print $response->check("Good Afternoon"); // random result = ["Good Afternoon","Hi","Hello"]
//fetching information from a database | return string
print $response->checkDataBase("Good Afternoon"); // random result = ["Good Afternoon","Hi","Hello"]
- To configure the database connection using this modeling example click here (project tigoCaval/crud).
- It is necessary to create the data tables according to this database modeling.