@@ -95,7 +95,7 @@ public static void main(String[] args) throws Exception {
9595 * Identifies entities in the string {@code text}.
9696 */
9797 public static void analyzeEntitiesText (String text ) throws Exception {
98- // [START analyze_entities_text ]
98+ // [START language_entities_text ]
9999 // Instantiate the Language client com.google.cloud.language.v1.LanguageServiceClient
100100 try (LanguageServiceClient language = LanguageServiceClient .create ()) {
101101 Document doc = Document .newBuilder ()
@@ -124,14 +124,14 @@ public static void analyzeEntitiesText(String text) throws Exception {
124124 }
125125 }
126126 }
127- // [END analyze_entities_text ]
127+ // [END language_entities_text ]
128128 }
129129
130130 /**
131131 * Identifies entities in the contents of the object at the given GCS {@code path}.
132132 */
133133 public static void analyzeEntitiesFile (String gcsUri ) throws Exception {
134- // [START analyze_entities_gcs ]
134+ // [START language_entities_file_gcs ]
135135 // Instantiate the Language client com.google.cloud.language.v1.LanguageServiceClient
136136 try (LanguageServiceClient language = LanguageServiceClient .create ()) {
137137 // set the GCS Content URI path to the file to be analyzed
@@ -161,14 +161,14 @@ public static void analyzeEntitiesFile(String gcsUri) throws Exception {
161161 }
162162 }
163163 }
164- // [END analyze_entities_gcs ]
164+ // [END language_entities_file_gcs ]
165165 }
166166
167167 /**
168168 * Identifies the sentiment in the string {@code text}.
169169 */
170170 public static Sentiment analyzeSentimentText (String text ) throws Exception {
171- // [START analyze_sentiment_text ]
171+ // [START language_sentiment_text ]
172172 // Instantiate the Language client com.google.cloud.language.v1.LanguageServiceClient
173173 try (LanguageServiceClient language = LanguageServiceClient .create ()) {
174174 Document doc = Document .newBuilder ()
@@ -185,14 +185,14 @@ public static Sentiment analyzeSentimentText(String text) throws Exception {
185185 }
186186 return sentiment ;
187187 }
188- // [END analyze_sentiment_text ]
188+ // [END language_sentiment_text ]
189189 }
190190
191191 /**
192192 * Gets {@link Sentiment} from the contents of the GCS hosted file.
193193 */
194194 public static Sentiment analyzeSentimentFile (String gcsUri ) throws Exception {
195- // [START analyze_sentiment_file ]
195+ // [START language_sentiment_file_gcs ]
196196 // Instantiate the Language client com.google.cloud.language.v1.LanguageServiceClient
197197 try (LanguageServiceClient language = LanguageServiceClient .create ()) {
198198 Document doc = Document .newBuilder ()
@@ -209,14 +209,14 @@ public static Sentiment analyzeSentimentFile(String gcsUri) throws Exception {
209209 }
210210 return sentiment ;
211211 }
212- // [END analyze_sentiment_file ]
212+ // [END language_sentiment_file_gcs ]
213213 }
214214
215215 /**
216216 * from the string {@code text}.
217217 */
218218 public static List <Token > analyzeSyntaxText (String text ) throws Exception {
219- // [START analyze_syntax_text ]
219+ // [START language_syntax_text ]
220220 // Instantiate the Language client com.google.cloud.language.v1.LanguageServiceClient
221221 try (LanguageServiceClient language = LanguageServiceClient .create ()) {
222222 Document doc = Document .newBuilder ()
@@ -252,14 +252,14 @@ public static List<Token> analyzeSyntaxText(String text) throws Exception {
252252 }
253253 return response .getTokensList ();
254254 }
255- // [END analyze_syntax_text ]
255+ // [END language_syntax_text ]
256256 }
257257
258258 /**
259259 * Get the syntax of the GCS hosted file.
260260 */
261261 public static List <Token > analyzeSyntaxFile (String gcsUri ) throws Exception {
262- // [START analyze_syntax_file ]
262+ // [START language_syntax_file_gcs ]
263263 // Instantiate the Language client com.google.cloud.language.v1.LanguageServiceClient
264264 try (LanguageServiceClient language = LanguageServiceClient .create ()) {
265265 Document doc = Document .newBuilder ()
@@ -296,14 +296,14 @@ public static List<Token> analyzeSyntaxFile(String gcsUri) throws Exception {
296296
297297 return response .getTokensList ();
298298 }
299- // [END analyze_syntax_file ]
299+ // [END language_syntax_file_gcs ]
300300 }
301301
302302 /**
303303 * Detects categories in text using the Language Beta API.
304304 */
305305 public static void classifyText (String text ) throws Exception {
306- // [START classify_text ]
306+ // [START language_classify_text ]
307307 // Instantiate the Language client com.google.cloud.language.v1.LanguageServiceClient
308308 try (LanguageServiceClient language = LanguageServiceClient .create ()) {
309309 // set content to the text string
@@ -322,14 +322,14 @@ public static void classifyText(String text) throws Exception {
322322 category .getName (), category .getConfidence ());
323323 }
324324 }
325- // [END classify_text ]
325+ // [END language_classify_text ]
326326 }
327327
328328 /**
329329 * Detects categories in a GCS hosted file using the Language Beta API.
330330 */
331331 public static void classifyFile (String gcsUri ) throws Exception {
332- // [START classify_file ]
332+ // [START language_classify_file_gcs ]
333333 // Instantiate the Language client com.google.cloud.language.v1.LanguageServiceClient
334334 try (LanguageServiceClient language = LanguageServiceClient .create ()) {
335335 // set the GCS content URI path
@@ -348,14 +348,14 @@ public static void classifyFile(String gcsUri) throws Exception {
348348 category .getName (), category .getConfidence ());
349349 }
350350 }
351- // [END classify_file ]
351+ // [END language_classify_file_gcs ]
352352 }
353353
354354 /**
355355 * Detects the entity sentiments in the string {@code text} using the Language Beta API.
356356 */
357357 public static void entitySentimentText (String text ) throws Exception {
358- // [START entity_sentiment_text ]
358+ // [START language_entity_sentiment_text ]
359359 // Instantiate the Language client com.google.cloud.language.v1.LanguageServiceClient
360360 try (LanguageServiceClient language = LanguageServiceClient .create ()) {
361361 Document doc = Document .newBuilder ()
@@ -379,14 +379,14 @@ public static void entitySentimentText(String text) throws Exception {
379379 }
380380 }
381381 }
382- // [END entity_sentiment_text ]
382+ // [END language_entity_sentiment_text ]
383383 }
384384
385385 /**
386386 * Identifies the entity sentiments in the the GCS hosted file using the Language Beta API.
387387 */
388388 public static void entitySentimentFile (String gcsUri ) throws Exception {
389- // [START entity_sentiment_file ]
389+ // [START language_entity_sentiment_file_gcs ]
390390 // Instantiate the Language client com.google.cloud.language.v1.LanguageServiceClient
391391 try (LanguageServiceClient language = LanguageServiceClient .create ()) {
392392 Document doc = Document .newBuilder ()
@@ -413,6 +413,6 @@ public static void entitySentimentFile(String gcsUri) throws Exception {
413413 }
414414 }
415415 }
416- // [END entity_sentiment_file ]
416+ // [END language_entity_sentiment_file_gcs ]
417417 }
418418}
0 commit comments