-
Notifications
You must be signed in to change notification settings - Fork 17
NaturalLanguageClassifier
namespace WatsonSDK\Services;
The Natural Language Classifier service understands the intent behind text and returns a corresponding classification, complete with a confidence score. For example “What is the weather like today? or “Is it hot out?” or “Is it going to be nice today?” are all ways of asking about “temperature”. Use NLC to answer questions in a contact center, create chatbots, categorize volumes of written content and more.
public class NaturalLanguageClassifier extends WatsonService
Used to initialize a NaturalLanguageClassifier instance from the instance of WatsonCredential.
function __construct(WatsonCredential $credential);
Natural Language Classifier service URL.
const BASE_URL = 'https://gateway.watsonplatform.net/natural-language-classifier/api/v1';
Supported language in the field of training_metadata
.
const LANGUAGE_EN = 'en';
const LANGUAGE_AR = 'ar';
const LANGUAGE_FR = 'fr';
const LANGUAGE_DE = 'de';
const LANGUAGE_IT = 'it';
const LANGUAGE_JA = 'ja';
const LANGUAGE_PT = 'pt';
const LANGUAGE_ES = 'es';
Perform the classify
of the given variables of text and classifier ID.
public function classify($text, $classifier_id);
Sends data to create and train a classifier and returns information about the new classifier.
public function createClassifier($training_file_path, $language = self::LANGUAGE_EN, $name = NULL);
Retrieves the list of classifiers for the service instance.
public function listClassifiers();
Returns status and other information about a classifier.
public function getClassifier($classifier_id);
Deletes a classifier.
public function deleteClassifier($classifier_id);
$nlc = new NaturalLanguageClassifier(WatsonCredential::initWithCredentials('your_username', 'your_password'));
$result = $nlc->classify('your text to be classified.', 'your classifier id');
Copyright 2017 GCG GBS CTO Office under the Apache 2.0 license.