Skip to content

NaturalLanguageUnderstanding

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

Analyze text to extract meta-data from content such as concepts, entities, keywords, categories, sentiment, emotion, relations, semantic roles, using natural language understanding. With custom annotation models developed using Watson Knowledge Studio, identify industry/domain specific entities and relations in unstructured text.

public class NaturalLanguageUnderstanding extends WatsonService

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

function __construct(WatsonCredential $credential);

Perform the analyze of the given instance of WatsonSDK\Services\NaturalLanguageUnderstanding\AnalyzeModel.

public function analyze(AnalyzeModel $model);

List available custom models

public function listModels();

Delete a custom model

public function deleteModels($modelId);

Sample

$nlu = new NaturalLanguageUnderstanding(WatsonCredential::initWithCredentials('your_username', 'your_password'));

$model = new AnalyzeModel('Watson PHP SDK for IBM Watson Developer Cloud.', [ 'keywords' => [ 'limit' => 5 ] ]);
$result = $nlu->analyze($model);
Clone this wiki locally