watson_developer_cloud.natural_language_classifier_v1 module

IBM Watson™ Natural Language Classifier uses machine learning algorithms to return the top matching predefined classes for short text input. You create and train a classifier to connect predefined classes to example texts so that the service can apply those classes to new inputs.

class Classification(classifier_id=None, url=None, text=None, top_class=None, classes=None)[source]

Bases: object

Response from the classifier for a phrase.

Attr str classifier_id

(optional) Unique identifier for this classifier.

Attr str url

(optional) Link to the classifier.

Attr str text

(optional) The submitted phrase.

Attr str top_class

(optional) The class with the highest confidence.

Attr list[ClassifiedClass] classes

(optional) An array of up to ten class-confidence

pairs sorted in descending order of confidence.

class ClassificationCollection(classifier_id=None, url=None, collection=None)[source]

Bases: object

Response from the classifier for multiple phrases.

Attr str classifier_id

(optional) Unique identifier for this classifier.

Attr str url

(optional) Link to the classifier.

Attr list[CollectionItem] collection

(optional) An array of classifier responses for

each submitted phrase.

class ClassifiedClass(confidence=None, class_name=None)[source]

Bases: object

Class and confidence.

Attr float confidence

(optional) A decimal percentage that represents the confidence

that Watson has in this class. Higher values represent higher confidences. :attr str class_name: (optional) Class label.

class Classifier(url, classifier_id, name=None, status=None, created=None, status_description=None, language=None)[source]

Bases: object

A classifier for natural language phrases.

Attr str name

(optional) User-supplied name for the classifier.

Attr str url

Link to the classifier.

Attr str status

(optional) The state of the classifier.

Attr str classifier_id

Unique identifier for this classifier.

Attr datetime created

(optional) Date and time (UTC) the classifier was created.

Attr str status_description

(optional) Additional detail about the status.

Attr str language

(optional) The language used for the classifier.

class ClassifierList(classifiers)[source]

Bases: object

List of available classifiers.

Attr list[Classifier] classifiers

The classifiers available to the user. Returns an

empty array if no classifiers are available.

class ClassifyInput(text)[source]

Bases: object

Request payload to classify.

Attr str text

The submitted phrase. The maximum length is 2048 characters.

class CollectionItem(text=None, top_class=None, classes=None)[source]

Bases: object

Response from the classifier for a phrase in a collection.

Attr str text

(optional) The submitted phrase. The maximum length is 2048

characters. :attr str top_class: (optional) The class with the highest confidence. :attr list[ClassifiedClass] classes: (optional) An array of up to ten class-confidence pairs sorted in descending order of confidence.