flyingbono / smart-bot
Smart multilinguage bot responder implemented in PHP, with learning capabilities
dev-master / 1.0.x-dev
2016-12-22 10:16 UTC
Requires
- php: >=5.5.13
- doctrine/annotations: ~1.2
- php-di/php-di: ^5.1
Requires (Dev)
- codeclimate/php-test-reporter: dev-master
- phpmd/phpmd: ~2.3
- phpunit/phpunit: ~4.5
- squizlabs/php_codesniffer: 2.*
This package is not auto-updated.
Last update: 2024-11-01 21:28:48 UTC
README
Multilinguage bot responder implemented in PHP, with learning capabilities
Installation :
$ composer.phar require flyingbono/smart-bot
Basic usage :
<?php require_once '../vendor/autoload.php'; // Options : all are optionals $options = array( 'listener' => 'SmartBot\Bot\Listener\EnUSListener', // default listener (default: EnUSListener) 'innate' => 'file.php', // Innate memory data (default: null) 'entity' => 'CallerUID', // ID of the person talking to the bot (default: null) 'context' => ['Humor:Funny'], // List of the bot contexts (users-defined) ); $bot = new \SmartBot\Bot( // Data path for acquired memory storage) '/tmp/smartbot-data/', // Bot options $options ); // Load innate memory (optionnal) // @see (documentation : todo) $bot -> setInnateMemory( $memoryFilePath ); // Learn some data (optional) $bot -> learn('Weather', 'Sun shine'); $bot -> learn('Myself:name', 'Smart BOT'); // ... // Add custom listener (optionnal) $bot -> addListener( 'SmartBot\Bot\Listener\CustomListener' ); // Add custom contexts $bot -> addContext('Time:morning'); $bot -> addContext(array('Humor:Funny','...')); // Sets the user who's talking to the bot (required) // It may be the logged user in your app, // or simply the PHP Session ID $bot -> setEntity('Bruno VIBERT'); // Talk to the bot (optionnal, but recommanded ;)) $response = $bot -> talk('Hello !'); // Hello, Hi... $response = $bot -> talk('My name is John'); // Ok, John, I will remember that ! $response = $bot -> talk('Hi'); // Hello, John