@@ -54,7 +54,7 @@ public class ToneAnalyzer extends WatsonService {
5454
5555 private static final Logger log = Logger .getLogger (ToneAnalyzer .class
5656 .getName ());
57- private static final String URL = "https://gateway.watsonplatform.net/tone-analyzer-beta /api" ;
57+ private static final String URL = "https://gateway.watsonplatform.net/tone-analyzer-experimental /api" ;
5858
5959 private static final Type listScorecardsType = new TypeToken <List <Scorecard >>() {
6060 }.getType ();
@@ -66,6 +66,22 @@ public ToneAnalyzer() {
6666 setEndPoint (URL );
6767 }
6868
69+ /**
70+ * Analyzes the "tone" of a piece of text using the default scorecard.
71+ * The message is analyzed from several tones (social tone, emotional tone,
72+ * writing tone), and for each of them various traits are derived
73+ * (such as conscientiousness, agreeableness, openness).
74+ *
75+ *
76+ * @param text
77+ * The text to analyze
78+ * @return the {@link Tone} with the response
79+ *
80+ */
81+ public Tone getTone (final String text ) {
82+ return getTone (text ,null );
83+ }
84+
6985 /**
7086 * Analyzes the "tone" of a piece of text. The message is analyzed from
7187 * several tones (social tone, emotional tone, writing tone), and for each
@@ -87,7 +103,9 @@ public Tone getTone(final String text, final String scorecard) {
87103
88104 JsonObject contentJson = new JsonObject ();
89105 contentJson .addProperty (TEXT , text );
90- contentJson .addProperty (SCORECARD , text );
106+
107+ if (scorecard != null )
108+ contentJson .addProperty (SCORECARD , text );
91109
92110 HttpRequestBase request = Request .Post ("/v1/tone" )
93111 .withContent (contentJson ).build ();
@@ -135,7 +153,7 @@ public Tone getTone(final String text, final String scorecard) {
135153 *
136154 * @return {@link SynonymResult}
137155 */
138- public SynonymResult getSynynyms (Map <String , Object > params ) {
156+ public SynonymResult getSynonyms (Map <String , Object > params ) {
139157 String [] words = (String []) params .get ("words" );
140158 String [] traits = (String []) params .get ("traits" );
141159 String [] context = (String []) params .get ("context" );
0 commit comments