Skip to content

This PHP library allows to connect IBM Tone Analyzer service easily.

Notifications You must be signed in to change notification settings

emrahonder/PHPLibForIBMToneAnalyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

PHP Lib For IBM Tone Analyzer

This PHP library allows to connect IBM Tone Analyzer service easily.

The IBM Watson™ Tone Analyzer service uses linguistic analysis to detect communication tones in written text. Use the Tone Analyzer service to understand conversations and communications, and then respond to customers appropriately at scale. To get details, visit offical documentation: https://www.ibm.com/watson/developercloud/tone-analyzer/api/v3/#introduction

This PHP library allows to connect this service easily.

Usage

Prerequisite

From IBM Bluemix panel, username and password should be taken.

Initialize

ibm_tone_analyzer.php file should be imported to your PHP lib. Then new object is created with credentials those are mentioned above.

require 'ibm_tone_analyzer.php';
$IBMTone = new IBMTone("[USERNAME]","[PASSWORD]");

Sample for "Analyze general tone"

$results = $IBMTone->analyze_general_tone("I lost my key, how can I take new one?");

Sample for "Analyze customer engagement tone"

Request:

$pairs = array();
$pair['text'] = 'How are you?';
$pair['user'] = 'agent';
$pairs[] = $pair;
$pair['text'] = 'Fine, thanks and you?';
$pair['user'] = 'customer';
$pairs[] = $pair;								
$pair['text'] = 'Thanks, how can I help you?';
$pair['user'] = 'agent';
$pairs[] = $pair;								
$pair['text'] = 'I lost my key, how can I take new one?';
$pair['user'] = 'customer';
$pairs[] = $pair;
$results = $IBMTone->analyze_customer_engagement_tone($pairs);

About

This PHP library allows to connect IBM Tone Analyzer service easily.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages