Options
All
  • Public
  • Public/Protected
  • All
Menu

Class NaturalLanguageClassifierV1

On 9 August 2021, IBM announced the deprecation of IBM Watson™ Natural Language Classifier. As of 9 September 2021, you cannot create new instances. However, existing instances are supported until 8 August 2022. The service will no longer be available on 8 August 2022.

As an alternative, consider migrating to IBM Watson Natural Language Understanding. For more information, see Migrating to Natural Language Understanding. {: deprecated} interfaces

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.

API Version: 1.0 See: https://cloud.ibm.com/docs/natural-language-classifier

Hierarchy

  • BaseService
    • NaturalLanguageClassifierV1

Index

Constructors

constructor

Properties

Static DEFAULT_SERVICE_NAME

DEFAULT_SERVICE_NAME: string = "natural_language_classifier"

Static DEFAULT_SERVICE_URL

DEFAULT_SERVICE_URL: string = "https://api.us-south.natural-language-classifier.watson.cloud.ibm.com"

Methods

classify

  • Classify a phrase.

    Returns label information for the input. The status must be Available before you can use the classifier to classify text.

    Parameters

    Name Type Attribute Description
    params ClassifyParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    classifierId string Classifier ID to use.
    text string The submitted phrase. The maximum length is 2048 characters.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<Classification>>

classifyCollection

  • Classify multiple phrases.

    Returns label information for multiple phrases. The status must be Available before you can use the classifier to classify text.

    Note that classifying Japanese texts is a beta feature.

    Parameters

    Name Type Attribute Description
    params ClassifyCollectionParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    classifierId string Classifier ID to use.
    collection ClassifyInput[] The submitted phrases.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<ClassificationCollection>>

createClassifier

  • Create classifier.

    Sends data to create and train a classifier and returns information about the new classifier.

    Parameters

    Name Type Attribute Description
    params CreateClassifierParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    trainingData ReadableStream | Buffer Training data in CSV format. Each text value must have at least one class. The data can include up to 3,000 classes and 20,000 records. For details, see [Data preparation](https://cloud.ibm.com/docs/natural-language-classifier?topic=natural-language-classifier-using-your-data).
    trainingMetadata ReadableStream | Buffer Metadata in JSON format. The metadata identifies the language of the data, and an optional name to identify the classifier. Specify the language with the 2-letter primary language code as assigned in ISO standard 639.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<Classifier>>

deleteClassifier

disableRetries

  • disableRetries(): void
  • Disables retries.

    Returns void

enableRetries

  • enableRetries(retryOptions?: RetryOptions): void
  • Enable retries for unfulfilled requests.

    Parameters

    Name Type Attribute Description
    retryOptions RetryOptions Optional

    configuration for retries

    Returns void

getAuthenticator

  • getAuthenticator(): any
  • Get the instance of the authenticator set on the service.

    Returns any

getClassifier

  • Get information about a classifier.

    Returns status and other information about a classifier.

    Parameters

    Name Type Attribute Description
    params GetClassifierParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    classifierId string Classifier ID to query.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<Classifier>>

getHttpClient

  • getHttpClient(): AxiosInstance
  • Get the Axios instance set on the service. All requests will be made using this instance.

    Returns AxiosInstance

listClassifiers

setEnableGzipCompression

  • setEnableGzipCompression(setting: boolean): void
  • Turn request body compression on or off.

    Parameters

    Name Type Attribute Description
    setting boolean

    Will turn it on if 'true', off if 'false'.

    Returns void

setServiceUrl

  • setServiceUrl(url: string): void
  • Set the service URL to send requests to.

    Parameters

    Name Type Attribute Description
    url string

    The base URL for the service.

    Returns void

Generated using TypeDoc