tigo / chatterbot
structure of a simple chatterbot
v0.0.2
2021-11-08 18:20 UTC
Requires
- php: >=7.3
- tigo/crud: ^0.0.1
README
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.
Introduction
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
Getting started
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"]
Configuration
- 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.