Skip to content

ToneAnalyzer

Michael edited this page Mar 21, 2017 · 6 revisions
namespace WatsonSDK\Services;

The IBM Watson Tone Analyzer service uses linguistic analysis to detect emotional tones, social propensities, and writing styles in written communication. Then it offers suggestions to help the writer improve their intended language tones.

class ToneAnalyzer extends WatsonService

Used to initialize a ToneAnalyzer instance from the instance of WatsonCredential.

function __construct(WatsonCredential $credential);

Analyzes the tone of a piece of text. The message is analyzed for several tones - social, emotional, and language. For each tone, various traits are derived. For example, conscientiousness, agreeableness, and openness. The parameters can be set in the given instance of WatsonSDK\Services\ToneAnalyzer\ToneModel.

public function Tone(ToneModel $model);

Sample

$analyzer = new ToneAnalyzer(WatsonCredential::initWithCredentials('your_username', 'your_password'));

$model = new ToneModel('your text to be analyzed.');
$result = $analyzer->getTone($model);
Clone this wiki locally