2222import com .google .api .client .http .HttpRequestInitializer ;
2323import com .google .api .client .json .JsonFactory ;
2424import com .google .api .client .json .jackson2 .JacksonFactory ;
25- import com .google .api .services .language .v1 .CloudNaturalLanguageAPI ;
26- import com .google .api .services .language .v1 .CloudNaturalLanguageAPIScopes ;
25+ import com .google .api .services .language .v1 .CloudNaturalLanguage ;
26+ import com .google .api .services .language .v1 .CloudNaturalLanguageScopes ;
2727import com .google .api .services .language .v1 .model .AnalyzeEntitiesRequest ;
2828import com .google .api .services .language .v1 .model .AnalyzeEntitiesResponse ;
2929import com .google .api .services .language .v1 .model .AnalyzeSentimentRequest ;
@@ -157,12 +157,12 @@ public static void printSyntax(PrintStream out, List<Token> tokens) {
157157 /**
158158 * Connects to the Natural Language API using Application Default Credentials.
159159 */
160- public static CloudNaturalLanguageAPI getLanguageService ()
160+ public static CloudNaturalLanguage getLanguageService ()
161161 throws IOException , GeneralSecurityException {
162162 GoogleCredential credential =
163- GoogleCredential .getApplicationDefault ().createScoped (CloudNaturalLanguageAPIScopes .all ());
163+ GoogleCredential .getApplicationDefault ().createScoped (CloudNaturalLanguageScopes .all ());
164164 JsonFactory jsonFactory = JacksonFactory .getDefaultInstance ();
165- return new CloudNaturalLanguageAPI .Builder (
165+ return new CloudNaturalLanguage .Builder (
166166 GoogleNetHttpTransport .newTrustedTransport (),
167167 jsonFactory , new HttpRequestInitializer () {
168168 @ Override
@@ -174,12 +174,12 @@ public void initialize(HttpRequest request) throws IOException {
174174 .build ();
175175 }
176176
177- private final CloudNaturalLanguageAPI languageApi ;
177+ private final CloudNaturalLanguage languageApi ;
178178
179179 /**
180180 * Constructs a {@link Analyze} which connects to the Cloud Natural Language API.
181181 */
182- public Analyze (CloudNaturalLanguageAPI languageApi ) {
182+ public Analyze (CloudNaturalLanguage languageApi ) {
183183 this .languageApi = languageApi ;
184184 }
185185
@@ -191,7 +191,7 @@ public List<Entity> analyzeEntities(String text) throws IOException {
191191 new AnalyzeEntitiesRequest ()
192192 .setDocument (new Document ().setContent (text ).setType ("PLAIN_TEXT" ))
193193 .setEncodingType ("UTF16" );
194- CloudNaturalLanguageAPI .Documents .AnalyzeEntities analyze =
194+ CloudNaturalLanguage .Documents .AnalyzeEntities analyze =
195195 languageApi .documents ().analyzeEntities (request );
196196
197197 AnalyzeEntitiesResponse response = analyze .execute ();
@@ -205,7 +205,7 @@ public Sentiment analyzeSentiment(String text) throws IOException {
205205 AnalyzeSentimentRequest request =
206206 new AnalyzeSentimentRequest ()
207207 .setDocument (new Document ().setContent (text ).setType ("PLAIN_TEXT" ));
208- CloudNaturalLanguageAPI .Documents .AnalyzeSentiment analyze =
208+ CloudNaturalLanguage .Documents .AnalyzeSentiment analyze =
209209 languageApi .documents ().analyzeSentiment (request );
210210
211211 AnalyzeSentimentResponse response = analyze .execute ();
@@ -220,7 +220,7 @@ public List<Token> analyzeSyntax(String text) throws IOException {
220220 new AnalyzeSyntaxRequest ()
221221 .setDocument (new Document ().setContent (text ).setType ("PLAIN_TEXT" ))
222222 .setEncodingType ("UTF16" );
223- CloudNaturalLanguageAPI .Documents .AnalyzeSyntax analyze =
223+ CloudNaturalLanguage .Documents .AnalyzeSyntax analyze =
224224 languageApi .documents ().analyzeSyntax (request );
225225 AnalyzeSyntaxResponse response = analyze .execute ();
226226 return response .getTokens ();
0 commit comments