public class ToneAnalyzer
extends com.ibm.cloud.sdk.core.service.BaseService
**Note:** Request logging is disabled for the Tone Analyzer service. Regardless of whether you set the `X-Watson-Learning-Opt-Out` request header, the service does not log or retain data from requests and responses.
Constructor and Description |
---|
ToneAnalyzer(java.lang.String versionDate)
Constructs a new `ToneAnalyzer` client using the DEFAULT_SERVICE_NAME.
|
ToneAnalyzer(java.lang.String versionDate,
com.ibm.cloud.sdk.core.security.Authenticator authenticator)
Constructs a new `ToneAnalyzer` client with the DEFAULT_SERVICE_NAME and the specified
Authenticator.
|
ToneAnalyzer(java.lang.String versionDate,
java.lang.String serviceName)
Constructs a new `ToneAnalyzer` client with the specified serviceName.
|
ToneAnalyzer(java.lang.String versionDate,
java.lang.String serviceName,
com.ibm.cloud.sdk.core.security.Authenticator authenticator)
Constructs a new `ToneAnalyzer` client with the specified Authenticator and serviceName.
|
Modifier and Type | Method and Description |
---|---|
com.ibm.cloud.sdk.core.http.ServiceCall<ToneAnalysis> |
tone(ToneOptions toneOptions)
Analyze general tone.
|
com.ibm.cloud.sdk.core.http.ServiceCall<UtteranceAnalyses> |
toneChat(ToneChatOptions toneChatOptions)
Analyze customer-engagement tone.
|
configureClient, configureHttpClient, configureService, createServiceCall, getAuthenticator, getClient, getEndPoint, getName, getServiceUrl, isJsonMimeType, isJsonPatchMimeType, processServiceCall, setAuthentication, setClient, setDefaultHeaders, setDefaultHeaders, setEndPoint, setServiceUrl, toString
public ToneAnalyzer(java.lang.String versionDate)
versionDate
- The version date (yyyy-MM-dd) of the REST API to use. Specifying this value
will keep your API calls from failing when the service introduces breaking changes.public ToneAnalyzer(java.lang.String versionDate, com.ibm.cloud.sdk.core.security.Authenticator authenticator)
versionDate
- The version date (yyyy-MM-dd) of the REST API to use. Specifying this value
will keep your API calls from failing when the service introduces breaking changes.authenticator
- the Authenticator instance to be configured for this servicepublic ToneAnalyzer(java.lang.String versionDate, java.lang.String serviceName)
versionDate
- The version date (yyyy-MM-dd) of the REST API to use. Specifying this value
will keep your API calls from failing when the service introduces breaking changes.serviceName
- The name of the service to configure.public ToneAnalyzer(java.lang.String versionDate, java.lang.String serviceName, com.ibm.cloud.sdk.core.security.Authenticator authenticator)
versionDate
- The version date (yyyy-MM-dd) of the REST API to use. Specifying this value
will keep your API calls from failing when the service introduces breaking changes.serviceName
- The name of the service to configure.authenticator
- the Authenticator instance to be configured for this servicepublic com.ibm.cloud.sdk.core.http.ServiceCall<ToneAnalysis> tone(ToneOptions toneOptions)
Use the general-purpose endpoint to analyze the tone of your input content. The service analyzes the content for emotional and language tones. The method always analyzes the tone of the full document; by default, it also analyzes the tone of each individual sentence of the content.
You can submit no more than 128 KB of total input content and no more than 1000 individual sentences in JSON, plain text, or HTML format. The service analyzes the first 1000 sentences for document-level analysis and only the first 100 sentences for sentence-level analysis.
Per the JSON specification, the default character encoding for JSON content is effectively always UTF-8; per the HTTP specification, the default encoding for plain text and HTML is ISO-8859-1 (effectively, the ASCII character set). When specifying a content type of plain text or HTML, include the `charset` parameter to indicate the character encoding of the input text; for example: `Content-Type: text/plain;charset=utf-8`. For `text/html`, the service removes HTML tags and analyzes only the textual content.
**See also:** [Using the general-purpose endpoint](https://cloud.ibm.com/docs/tone-analyzer?topic=tone-analyzer-utgpe#utgpe).
toneOptions
- the ToneOptions
containing the options for the callServiceCall
with a response type of ToneAnalysis
public com.ibm.cloud.sdk.core.http.ServiceCall<UtteranceAnalyses> toneChat(ToneChatOptions toneChatOptions)
Use the customer-engagement endpoint to analyze the tone of customer service and customer support conversations. For each utterance of a conversation, the method reports the most prevalent subset of the following seven tones: sad, frustrated, satisfied, excited, polite, impolite, and sympathetic.
If you submit more than 50 utterances, the service returns a warning for the overall content and analyzes only the first 50 utterances. If you submit a single utterance that contains more than 500 characters, the service returns an error for that utterance and does not analyze the utterance. The request fails if all utterances have more than 500 characters. Per the JSON specification, the default character encoding for JSON content is effectively always UTF-8.
**See also:** [Using the customer-engagement endpoint](https://cloud.ibm.com/docs/tone-analyzer?topic=tone-analyzer-utco#utco).
toneChatOptions
- the ToneChatOptions
containing the options for the callServiceCall
with a response type of UtteranceAnalyses