Skip to content

Commit bc1eacd

Browse files
jerjoudpebot
authored andcommitted
Update NL client lib. (GoogleCloudPlatform#398)
1 parent 5b7db1c commit bc1eacd

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

language/analysis/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ limitations under the License.
2525
<dependency>
2626
<groupId>com.google.apis</groupId>
2727
<artifactId>google-api-services-language</artifactId>
28-
<version>v1beta1-rev11-1.22.0</version>
28+
<version>v1beta1-rev13-1.22.0</version>
2929
</dependency>
3030
<dependency>
3131
<groupId>com.google.api-client</groupId>

language/analysis/src/main/java/com/google/cloud/language/samples/Analyze.java

+10-10
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
import com.google.api.client.http.HttpRequestInitializer;
2323
import com.google.api.client.json.JsonFactory;
2424
import 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;
2727
import com.google.api.services.language.v1beta1.model.AnalyzeEntitiesRequest;
2828
import com.google.api.services.language.v1beta1.model.AnalyzeEntitiesResponse;
2929
import 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

Comments
 (0)