@@ -61,7 +61,7 @@ public static void main(String[] args) throws Exception {
61
61
62
62
/** Detects sentiments from the string {@code text}. */
63
63
public static Sentiment analyzeSentimentText (String text , String lang ) throws Exception {
64
- // [START beta_sentiment_text ]
64
+ // [START language_beta_sentiment_text ]
65
65
// Instantiate a beta client : com.google.cloud.language.v1beta2.LanguageServiceClient
66
66
try (LanguageServiceClient language = LanguageServiceClient .create ()) {
67
67
// NL auto-detects the language, if not provided
@@ -87,12 +87,12 @@ public static Sentiment analyzeSentimentText(String text, String lang) throws Ex
87
87
}
88
88
return sentiment ;
89
89
}
90
- // [END beta_sentiment_text ]
90
+ // [END language_beta_sentiment_text ]
91
91
}
92
92
93
93
/** Detects categories in text using the Language Beta API. */
94
94
public static void classifyText (String text ) throws Exception {
95
- // [START classify_text ]
95
+ // [START language_classify_text ]
96
96
// Instantiate a beta client : com.google.cloud.language.v1beta2.LanguageServiceClient
97
97
try (LanguageServiceClient language = LanguageServiceClient .create ()) {
98
98
// set content to the text string
@@ -107,12 +107,12 @@ public static void classifyText(String text) throws Exception {
107
107
category .getName (), category .getConfidence ());
108
108
}
109
109
}
110
- // [END classify_text ]
110
+ // [END language_classify_text ]
111
111
}
112
112
113
113
/** Detects categories in a GCS hosted file using the Language Beta API. */
114
114
public static void classifyFile (String gcsUri ) throws Exception {
115
- // [START classify_file ]
115
+ // [START language_classify_file ]
116
116
// Instantiate a beta client : com.google.cloud.language.v1beta2.LanguageServiceClient
117
117
try (LanguageServiceClient language = LanguageServiceClient .create ()) {
118
118
// set the GCS content URI path
@@ -128,6 +128,6 @@ public static void classifyFile(String gcsUri) throws Exception {
128
128
category .getName (), category .getConfidence ());
129
129
}
130
130
}
131
- // [END classify_file ]
131
+ // [END language_classify_file ]
132
132
}
133
133
}
0 commit comments