You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Uses the general purpose endpoint to analyze the tone of your input content. The service can analyze the input for
102
-
* several tones: emotion, language, and social. It derives various characteristics for each tone that it analyzes.
103
-
* The method always analyzes the tone of the full document; by default, it also analyzes the tone of each individual
104
-
* sentence of the input. You can submit a maximum of 128 KB of content in JSON, plain text, or HTML format. Per
105
-
* the JSON specification, the default character encoding for JSON content is effectively always UTF-8; per the
106
-
* HTTP specification, the default encoding for plain text and HTML is ISO-8859-1 (effectively, the ASCII character
107
-
* set). When specifying a content type of plain text or HTML, include the `charset` parameter to indicate the
108
-
* character encoding of the input text; for example: `Content-Type: text/plain;charset=utf-8`. For `text/html`,
109
-
* the service removes HTML tags and analyzes only the textual content. Use the `POST` request method to analyze
110
-
* larger amounts of content in any of the available formats. Use the `GET` request method to analyze smaller
111
-
* quantities of plain text content.
99
+
* Uses 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. Use the `POST` request method to analyze larger amounts of content in any of the available formats. Use the `GET` request method to analyze smaller quantities of plain text content. 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. **Note:** The `tones` query parameter is no longer supported. The service continues to accept the parameter for backward-compatibility, but the parameter no longer affects the response.
112
100
*
113
101
* @param toneOptions the {@link ToneOptions} containing the options for the call
114
102
* @return the {@link ToneAnalysis} with the response
@@ -118,8 +106,11 @@ public ServiceCall<ToneAnalysis> tone(ToneOptions toneOptions) {
@@ -135,11 +126,7 @@ public ServiceCall<ToneAnalysis> tone(ToneOptions toneOptions) {
135
126
/**
136
127
* Analyze customer engagement tone.
137
128
*
138
-
* Uses the customer engagement endpoint to analyze the tone of customer service and customer support conversations.
139
-
* For each utterance of a conversation, the method reports the most prevalent subset of the following seven tones:
140
-
* sad, frustrated, satisfied, excited, polite, impolite, and sympathetic. You can submit a maximum of 128 KB of
141
-
* JSON input. Per the JSON specification, the default character encoding for JSON content is effectively always
142
-
* UTF-8.
129
+
* 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.
143
130
*
144
131
* @param toneChatOptions the {@link ToneChatOptions} containing the options for the call
145
132
* @return the {@link UtteranceAnalyses} with the response
@@ -148,6 +135,9 @@ public ServiceCall<UtteranceAnalyses> toneChat(ToneChatOptions toneChatOptions)
148
135
Validator.notNull(toneChatOptions, "toneChatOptions cannot be null");
* An array of `ToneCategory` objects that provides the results of the tone analysis for the full document of the
32
-
* input content. The service returns results only for the tones specified with the `tones` parameter of the request.
30
+
* An array of `ToneScore` objects that provides the results of the analysis for each qualifying tone of the document. The array includes results for any tone whose score is at least 0.5. The array is empty if no tone has a score that meets this threshold.
33
31
*
34
-
* @return the toneCategories
32
+
* @return the tones
35
33
*/
36
-
publicList<ToneCategory> getToneCategories() {
37
-
returntoneCategories;
34
+
publicList<ToneScore> getTones() {
35
+
returntones;
38
36
}
39
37
40
38
/**
41
-
* Sets the toneCategories.
39
+
* Gets the warning.
42
40
*
43
-
* @param toneCategories the new toneCategories
41
+
* A warning message if the overall content exceeds 128 KB or contains more than 1000 sentences. The service analyzes only the first 1000 sentences for document-level analysis and the first 100 sentences for sentence-level analysis.
Copy file name to clipboardExpand all lines: tone-analyzer/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3/model/SentenceAnalysis.java
+11-58Lines changed: 11 additions & 58 deletions
Original file line number
Diff line number
Diff line change
@@ -25,18 +25,12 @@ public class SentenceAnalysis extends GenericModel {
25
25
@SerializedName("sentence_id")
26
26
privateLongsentenceId;
27
27
privateStringtext;
28
-
@SerializedName("input_from")
29
-
privateLonginputFrom;
30
-
@SerializedName("input_to")
31
-
privateLonginputTo;
32
-
@SerializedName("tone_categories")
33
-
privateList<ToneCategory> toneCategories;
28
+
privateList<ToneScore> tones;
34
29
35
30
/**
36
31
* Gets the sentenceId.
37
32
*
38
-
* The unique identifier of a sentence of the input content. The first sentence has ID 0, and the ID of each
39
-
* subsequent sentence is incremented by one.
33
+
* The unique identifier of a sentence of the input content. The first sentence has ID 0, and the ID of each subsequent sentence is incremented by one.
40
34
*
41
35
* @return the sentenceId
42
36
*/
@@ -56,37 +50,14 @@ public String getText() {
56
50
}
57
51
58
52
/**
59
-
* Gets the inputFrom.
53
+
* Gets the tones.
60
54
*
61
-
* The offset of the first character of the sentence in the overall input content.
55
+
* An array of `ToneScore` objects that provides the results of the analysis for each qualifying tone of the sentence. The array includes results for any tone whose score is at least 0.5. The array is empty if no tone has a score that meets this threshold.
62
56
*
63
-
* @return the inputFrom
57
+
* @return the tones
64
58
*/
65
-
publicLonggetInputFrom() {
66
-
returninputFrom;
67
-
}
68
-
69
-
/**
70
-
* Gets the inputTo.
71
-
*
72
-
* The offset of the last character of the sentence in the overall input content.
73
-
*
74
-
* @return the inputTo
75
-
*/
76
-
publicLonggetInputTo() {
77
-
returninputTo;
78
-
}
79
-
80
-
/**
81
-
* Gets the toneCategories.
82
-
*
83
-
* An array of `ToneCategory` objects that provides the results for the tone analysis of the sentence. The service
84
-
* returns results only for the tones specified with the `tones` parameter of the request.
85
-
*
86
-
* @return the toneCategories
87
-
*/
88
-
publicList<ToneCategory> getToneCategories() {
89
-
returntoneCategories;
59
+
publicList<ToneScore> getTones() {
60
+
returntones;
90
61
}
91
62
92
63
/**
@@ -108,29 +79,11 @@ public void setText(final String text) {
Copy file name to clipboardExpand all lines: tone-analyzer/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3/model/ToneAnalysis.java
+2-4Lines changed: 2 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ public class ToneAnalysis extends GenericModel {
30
30
/**
31
31
* Gets the documentTone.
32
32
*
33
-
* An object of type `DocumentAnalysis` that provides the results for the full document of the input content.
33
+
* An object of type `DocumentAnalysis` that provides the results of the analysis for the full input document.
34
34
*
35
35
* @return the documentTone
36
36
*/
@@ -41,9 +41,7 @@ public DocumentAnalysis getDocumentTone() {
41
41
/**
42
42
* Gets the sentencesTone.
43
43
*
44
-
* An array of `SentenceAnalysis` objects that provides the results for the individual sentences of the input
45
-
* content. The service returns results only for the first 100 sentences of the input. The field is omitted if the
46
-
* `sentences` parameter of the request is set to `false`.
44
+
* An array of `SentenceAnalysis` objects that provides the results of the analysis for the individual sentences of the input content. The service returns results only for the first 100 sentences of the input. The field is omitted if the sentences parameter of the request is set to `false`.
Copy file name to clipboardExpand all lines: tone-analyzer/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3/model/ToneChatOptions.java
+54Lines changed: 54 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -23,16 +23,47 @@
23
23
*/
24
24
publicclassToneChatOptionsextendsGenericModel {
25
25
26
+
/**
27
+
* The desired language of the response. For two-character arguments, regional variants are treated as their parent language; for example, `en-US` is interpreted as `en`.
28
+
*/
29
+
publicinterfaceAcceptLanguage {
30
+
/** ar. */
31
+
StringAR = "ar";
32
+
/** de. */
33
+
StringDE = "de";
34
+
/** en. */
35
+
StringEN = "en";
36
+
/** es. */
37
+
StringES = "es";
38
+
/** fr. */
39
+
StringFR = "fr";
40
+
/** it. */
41
+
StringIT = "it";
42
+
/** ja. */
43
+
StringJA = "ja";
44
+
/** ko. */
45
+
StringKO = "ko";
46
+
/** pt-br. */
47
+
StringPT_BR = "pt-br";
48
+
/** zh-cn. */
49
+
StringZH_CN = "zh-cn";
50
+
/** zh-tw. */
51
+
StringZH_TW = "zh-tw";
52
+
}
53
+
26
54
privateList<Utterance> utterances;
55
+
privateStringacceptLanguage;
27
56
28
57
/**
29
58
* Builder.
30
59
*/
31
60
publicstaticclassBuilder {
32
61
privateList<Utterance> utterances;
62
+
privateStringacceptLanguage;
33
63
34
64
privateBuilder(ToneChatOptionstoneChatOptions) {
35
65
utterances = toneChatOptions.utterances;
66
+
acceptLanguage = toneChatOptions.acceptLanguage;
36
67
}
37
68
38
69
/**
@@ -85,11 +116,23 @@ public Builder utterances(List<Utterance> utterances) {
Validator.notNull(builder.utterances, "utterances cannot be null");
92
134
utterances = builder.utterances;
135
+
acceptLanguage = builder.acceptLanguage;
93
136
}
94
137
95
138
/**
@@ -111,4 +154,15 @@ public Builder newBuilder() {
111
154
publicList<Utterance> utterances() {
112
155
returnutterances;
113
156
}
157
+
158
+
/**
159
+
* Gets the acceptLanguage.
160
+
*
161
+
* The desired language of the response. For two-character arguments, regional variants are treated as their parent language; for example, `en-US` is interpreted as `en`.
Copy file name to clipboardExpand all lines: tone-analyzer/src/main/java/com/ibm/watson/developer_cloud/tone_analyzer/v3/model/ToneChatScore.java
+2-5Lines changed: 2 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -29,8 +29,7 @@ public class ToneChatScore extends GenericModel {
29
29
/**
30
30
* Gets the score.
31
31
*
32
-
* The score for the tone in the range of 0.5 to 1. A score greater than 0.75 indicates a high likelihood that the
33
-
* tone is perceived in the utterance.
32
+
* The score for the tone in the range of 0.5 to 1. A score greater than 0.75 indicates a high likelihood that the tone is perceived in the utterance.
34
33
*
35
34
* @return the score
36
35
*/
@@ -41,9 +40,7 @@ public Double getScore() {
41
40
/**
42
41
* Gets the toneId.
43
42
*
44
-
* The unique, non-localized identifier of the tone for the results. The service can return results for the
45
-
* following tone IDs: `sad`, `frustrated`, `satisfied`, `excited`, `polite`, `impolite`, and `sympathetic`. The
46
-
* service returns results only for tones whose scores meet a minimum threshold of 0.5.
43
+
* The unique, non-localized identifier of the tone for the results. The service can return results for the following tone IDs: `sad`, `frustrated`, `satisfied`, `excited`, `polite`, `impolite`, and `sympathetic`. The service returns results only for tones whose scores meet a minimum threshold of 0.5.
0 commit comments