Skip to content

Smart multilinguage bot responder implemented in PHP, with learning capabilities

License

Notifications You must be signed in to change notification settings

flyingbono/SmartBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SmartBot

Build Status Code Climate Test Coverage Issue Count Issue Count Listeners

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

About

Smart multilinguage bot responder implemented in PHP, with learning capabilities

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages