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 .v1beta1 .CloudNaturalLanguageAPI ;
26- import com .google .api .services .language .v1beta1 .CloudNaturalLanguageAPIScopes ;
25+ import com .google .api .services .language .v1beta1 .CloudNaturalLanguage ;
26+ import com .google .api .services .language .v1beta1 .CloudNaturalLanguageScopes ;
2727import com .google .api .services .language .v1beta1 .model .AnalyzeEntitiesRequest ;
2828import com .google .api .services .language .v1beta1 .model .AnalyzeEntitiesResponse ;
2929import com .google .api .services .language .v1beta1 .model .AnalyzeSentimentRequest ;
@@ -136,12 +136,12 @@ public static void printSyntax(PrintStream out, List<Token> tokens) {
136136 /**
137137 * Connects to the Natural Language API using Application Default Credentials.
138138 */
139- public static CloudNaturalLanguageAPI getLanguageService ()
139+ public static CloudNaturalLanguage getLanguageService ()
140140 throws IOException , GeneralSecurityException {
141141 GoogleCredential credential =
142- GoogleCredential .getApplicationDefault ().createScoped (CloudNaturalLanguageAPIScopes .all ());
142+ GoogleCredential .getApplicationDefault ().createScoped (CloudNaturalLanguageScopes .all ());
143143 JsonFactory jsonFactory = JacksonFactory .getDefaultInstance ();
144- return new CloudNaturalLanguageAPI .Builder (
144+ return new CloudNaturalLanguage .Builder (
145145 GoogleNetHttpTransport .newTrustedTransport (),
146146 jsonFactory , new HttpRequestInitializer () {
147147 @ Override
@@ -153,12 +153,12 @@ public void initialize(HttpRequest request) throws IOException {
153153 .build ();
154154 }
155155
156- private final CloudNaturalLanguageAPI languageApi ;
156+ private final CloudNaturalLanguage languageApi ;
157157
158158 /**
159159 * Constructs a {@link Analyze} which connects to the Cloud Natural Language API.
160160 */
161- public Analyze (CloudNaturalLanguageAPI languageApi ) {
161+ public Analyze (CloudNaturalLanguage languageApi ) {
162162 this .languageApi = languageApi ;
163163 }
164164
@@ -170,7 +170,7 @@ public List<Entity> analyzeEntities(String text) throws IOException {
170170 new AnalyzeEntitiesRequest ()
171171 .setDocument (new Document ().setContent (text ).setType ("PLAIN_TEXT" ))
172172 .setEncodingType ("UTF16" );
173- CloudNaturalLanguageAPI .Documents .AnalyzeEntities analyze =
173+ CloudNaturalLanguage .Documents .AnalyzeEntities analyze =
174174 languageApi .documents ().analyzeEntities (request );
175175
176176 AnalyzeEntitiesResponse response = analyze .execute ();
@@ -184,7 +184,7 @@ public Sentiment analyzeSentiment(String text) throws IOException {
184184 AnalyzeSentimentRequest request =
185185 new AnalyzeSentimentRequest ()
186186 .setDocument (new Document ().setContent (text ).setType ("PLAIN_TEXT" ));
187- CloudNaturalLanguageAPI .Documents .AnalyzeSentiment analyze =
187+ CloudNaturalLanguage .Documents .AnalyzeSentiment analyze =
188188 languageApi .documents ().analyzeSentiment (request );
189189
190190 AnalyzeSentimentResponse response = analyze .execute ();
@@ -200,7 +200,7 @@ public List<Token> analyzeSyntax(String text) throws IOException {
200200 .setDocument (new Document ().setContent (text ).setType ("PLAIN_TEXT" ))
201201 .setFeatures (new Features ().setExtractSyntax (true ))
202202 .setEncodingType ("UTF16" );
203- CloudNaturalLanguageAPI .Documents .AnnotateText analyze =
203+ CloudNaturalLanguage .Documents .AnnotateText analyze =
204204 languageApi .documents ().annotateText (request );
205205
206206 AnnotateTextResponse response = analyze .execute ();
0 commit comments