com.google.cloud.language.v1.LanguageServiceGrpc Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of grpc-google-cloud-language-v1 Show documentation
Show all versions of grpc-google-cloud-language-v1 Show documentation
GRPC library for grpc-google-cloud-language-v1
/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.cloud.language.v1;
import static io.grpc.MethodDescriptor.generateFullMethodName;
/**
*
*
*
* Provides text analysis operations such as sentiment analysis and entity
* recognition.
*
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler",
comments = "Source: google/cloud/language/v1/language_service.proto")
@io.grpc.stub.annotations.GrpcGenerated
public final class LanguageServiceGrpc {
private LanguageServiceGrpc() {}
public static final java.lang.String SERVICE_NAME = "google.cloud.language.v1.LanguageService";
// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<
com.google.cloud.language.v1.AnalyzeSentimentRequest,
com.google.cloud.language.v1.AnalyzeSentimentResponse>
getAnalyzeSentimentMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "AnalyzeSentiment",
requestType = com.google.cloud.language.v1.AnalyzeSentimentRequest.class,
responseType = com.google.cloud.language.v1.AnalyzeSentimentResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<
com.google.cloud.language.v1.AnalyzeSentimentRequest,
com.google.cloud.language.v1.AnalyzeSentimentResponse>
getAnalyzeSentimentMethod() {
io.grpc.MethodDescriptor<
com.google.cloud.language.v1.AnalyzeSentimentRequest,
com.google.cloud.language.v1.AnalyzeSentimentResponse>
getAnalyzeSentimentMethod;
if ((getAnalyzeSentimentMethod = LanguageServiceGrpc.getAnalyzeSentimentMethod) == null) {
synchronized (LanguageServiceGrpc.class) {
if ((getAnalyzeSentimentMethod = LanguageServiceGrpc.getAnalyzeSentimentMethod) == null) {
LanguageServiceGrpc.getAnalyzeSentimentMethod =
getAnalyzeSentimentMethod =
io.grpc.MethodDescriptor
.
newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "AnalyzeSentiment"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(
io.grpc.protobuf.ProtoUtils.marshaller(
com.google.cloud.language.v1.AnalyzeSentimentRequest
.getDefaultInstance()))
.setResponseMarshaller(
io.grpc.protobuf.ProtoUtils.marshaller(
com.google.cloud.language.v1.AnalyzeSentimentResponse
.getDefaultInstance()))
.setSchemaDescriptor(
new LanguageServiceMethodDescriptorSupplier("AnalyzeSentiment"))
.build();
}
}
}
return getAnalyzeSentimentMethod;
}
private static volatile io.grpc.MethodDescriptor<
com.google.cloud.language.v1.AnalyzeEntitiesRequest,
com.google.cloud.language.v1.AnalyzeEntitiesResponse>
getAnalyzeEntitiesMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "AnalyzeEntities",
requestType = com.google.cloud.language.v1.AnalyzeEntitiesRequest.class,
responseType = com.google.cloud.language.v1.AnalyzeEntitiesResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<
com.google.cloud.language.v1.AnalyzeEntitiesRequest,
com.google.cloud.language.v1.AnalyzeEntitiesResponse>
getAnalyzeEntitiesMethod() {
io.grpc.MethodDescriptor<
com.google.cloud.language.v1.AnalyzeEntitiesRequest,
com.google.cloud.language.v1.AnalyzeEntitiesResponse>
getAnalyzeEntitiesMethod;
if ((getAnalyzeEntitiesMethod = LanguageServiceGrpc.getAnalyzeEntitiesMethod) == null) {
synchronized (LanguageServiceGrpc.class) {
if ((getAnalyzeEntitiesMethod = LanguageServiceGrpc.getAnalyzeEntitiesMethod) == null) {
LanguageServiceGrpc.getAnalyzeEntitiesMethod =
getAnalyzeEntitiesMethod =
io.grpc.MethodDescriptor
.
newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "AnalyzeEntities"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(
io.grpc.protobuf.ProtoUtils.marshaller(
com.google.cloud.language.v1.AnalyzeEntitiesRequest
.getDefaultInstance()))
.setResponseMarshaller(
io.grpc.protobuf.ProtoUtils.marshaller(
com.google.cloud.language.v1.AnalyzeEntitiesResponse
.getDefaultInstance()))
.setSchemaDescriptor(
new LanguageServiceMethodDescriptorSupplier("AnalyzeEntities"))
.build();
}
}
}
return getAnalyzeEntitiesMethod;
}
private static volatile io.grpc.MethodDescriptor<
com.google.cloud.language.v1.AnalyzeEntitySentimentRequest,
com.google.cloud.language.v1.AnalyzeEntitySentimentResponse>
getAnalyzeEntitySentimentMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "AnalyzeEntitySentiment",
requestType = com.google.cloud.language.v1.AnalyzeEntitySentimentRequest.class,
responseType = com.google.cloud.language.v1.AnalyzeEntitySentimentResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<
com.google.cloud.language.v1.AnalyzeEntitySentimentRequest,
com.google.cloud.language.v1.AnalyzeEntitySentimentResponse>
getAnalyzeEntitySentimentMethod() {
io.grpc.MethodDescriptor<
com.google.cloud.language.v1.AnalyzeEntitySentimentRequest,
com.google.cloud.language.v1.AnalyzeEntitySentimentResponse>
getAnalyzeEntitySentimentMethod;
if ((getAnalyzeEntitySentimentMethod = LanguageServiceGrpc.getAnalyzeEntitySentimentMethod)
== null) {
synchronized (LanguageServiceGrpc.class) {
if ((getAnalyzeEntitySentimentMethod = LanguageServiceGrpc.getAnalyzeEntitySentimentMethod)
== null) {
LanguageServiceGrpc.getAnalyzeEntitySentimentMethod =
getAnalyzeEntitySentimentMethod =
io.grpc.MethodDescriptor
.
newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
generateFullMethodName(SERVICE_NAME, "AnalyzeEntitySentiment"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(
io.grpc.protobuf.ProtoUtils.marshaller(
com.google.cloud.language.v1.AnalyzeEntitySentimentRequest
.getDefaultInstance()))
.setResponseMarshaller(
io.grpc.protobuf.ProtoUtils.marshaller(
com.google.cloud.language.v1.AnalyzeEntitySentimentResponse
.getDefaultInstance()))
.setSchemaDescriptor(
new LanguageServiceMethodDescriptorSupplier("AnalyzeEntitySentiment"))
.build();
}
}
}
return getAnalyzeEntitySentimentMethod;
}
private static volatile io.grpc.MethodDescriptor<
com.google.cloud.language.v1.AnalyzeSyntaxRequest,
com.google.cloud.language.v1.AnalyzeSyntaxResponse>
getAnalyzeSyntaxMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "AnalyzeSyntax",
requestType = com.google.cloud.language.v1.AnalyzeSyntaxRequest.class,
responseType = com.google.cloud.language.v1.AnalyzeSyntaxResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<
com.google.cloud.language.v1.AnalyzeSyntaxRequest,
com.google.cloud.language.v1.AnalyzeSyntaxResponse>
getAnalyzeSyntaxMethod() {
io.grpc.MethodDescriptor<
com.google.cloud.language.v1.AnalyzeSyntaxRequest,
com.google.cloud.language.v1.AnalyzeSyntaxResponse>
getAnalyzeSyntaxMethod;
if ((getAnalyzeSyntaxMethod = LanguageServiceGrpc.getAnalyzeSyntaxMethod) == null) {
synchronized (LanguageServiceGrpc.class) {
if ((getAnalyzeSyntaxMethod = LanguageServiceGrpc.getAnalyzeSyntaxMethod) == null) {
LanguageServiceGrpc.getAnalyzeSyntaxMethod =
getAnalyzeSyntaxMethod =
io.grpc.MethodDescriptor
.
newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "AnalyzeSyntax"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(
io.grpc.protobuf.ProtoUtils.marshaller(
com.google.cloud.language.v1.AnalyzeSyntaxRequest
.getDefaultInstance()))
.setResponseMarshaller(
io.grpc.protobuf.ProtoUtils.marshaller(
com.google.cloud.language.v1.AnalyzeSyntaxResponse
.getDefaultInstance()))
.setSchemaDescriptor(
new LanguageServiceMethodDescriptorSupplier("AnalyzeSyntax"))
.build();
}
}
}
return getAnalyzeSyntaxMethod;
}
private static volatile io.grpc.MethodDescriptor<
com.google.cloud.language.v1.ClassifyTextRequest,
com.google.cloud.language.v1.ClassifyTextResponse>
getClassifyTextMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "ClassifyText",
requestType = com.google.cloud.language.v1.ClassifyTextRequest.class,
responseType = com.google.cloud.language.v1.ClassifyTextResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<
com.google.cloud.language.v1.ClassifyTextRequest,
com.google.cloud.language.v1.ClassifyTextResponse>
getClassifyTextMethod() {
io.grpc.MethodDescriptor<
com.google.cloud.language.v1.ClassifyTextRequest,
com.google.cloud.language.v1.ClassifyTextResponse>
getClassifyTextMethod;
if ((getClassifyTextMethod = LanguageServiceGrpc.getClassifyTextMethod) == null) {
synchronized (LanguageServiceGrpc.class) {
if ((getClassifyTextMethod = LanguageServiceGrpc.getClassifyTextMethod) == null) {
LanguageServiceGrpc.getClassifyTextMethod =
getClassifyTextMethod =
io.grpc.MethodDescriptor
.
newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "ClassifyText"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(
io.grpc.protobuf.ProtoUtils.marshaller(
com.google.cloud.language.v1.ClassifyTextRequest
.getDefaultInstance()))
.setResponseMarshaller(
io.grpc.protobuf.ProtoUtils.marshaller(
com.google.cloud.language.v1.ClassifyTextResponse
.getDefaultInstance()))
.setSchemaDescriptor(
new LanguageServiceMethodDescriptorSupplier("ClassifyText"))
.build();
}
}
}
return getClassifyTextMethod;
}
private static volatile io.grpc.MethodDescriptor<
com.google.cloud.language.v1.ModerateTextRequest,
com.google.cloud.language.v1.ModerateTextResponse>
getModerateTextMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "ModerateText",
requestType = com.google.cloud.language.v1.ModerateTextRequest.class,
responseType = com.google.cloud.language.v1.ModerateTextResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<
com.google.cloud.language.v1.ModerateTextRequest,
com.google.cloud.language.v1.ModerateTextResponse>
getModerateTextMethod() {
io.grpc.MethodDescriptor<
com.google.cloud.language.v1.ModerateTextRequest,
com.google.cloud.language.v1.ModerateTextResponse>
getModerateTextMethod;
if ((getModerateTextMethod = LanguageServiceGrpc.getModerateTextMethod) == null) {
synchronized (LanguageServiceGrpc.class) {
if ((getModerateTextMethod = LanguageServiceGrpc.getModerateTextMethod) == null) {
LanguageServiceGrpc.getModerateTextMethod =
getModerateTextMethod =
io.grpc.MethodDescriptor
.
newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "ModerateText"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(
io.grpc.protobuf.ProtoUtils.marshaller(
com.google.cloud.language.v1.ModerateTextRequest
.getDefaultInstance()))
.setResponseMarshaller(
io.grpc.protobuf.ProtoUtils.marshaller(
com.google.cloud.language.v1.ModerateTextResponse
.getDefaultInstance()))
.setSchemaDescriptor(
new LanguageServiceMethodDescriptorSupplier("ModerateText"))
.build();
}
}
}
return getModerateTextMethod;
}
private static volatile io.grpc.MethodDescriptor<
com.google.cloud.language.v1.AnnotateTextRequest,
com.google.cloud.language.v1.AnnotateTextResponse>
getAnnotateTextMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "AnnotateText",
requestType = com.google.cloud.language.v1.AnnotateTextRequest.class,
responseType = com.google.cloud.language.v1.AnnotateTextResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<
com.google.cloud.language.v1.AnnotateTextRequest,
com.google.cloud.language.v1.AnnotateTextResponse>
getAnnotateTextMethod() {
io.grpc.MethodDescriptor<
com.google.cloud.language.v1.AnnotateTextRequest,
com.google.cloud.language.v1.AnnotateTextResponse>
getAnnotateTextMethod;
if ((getAnnotateTextMethod = LanguageServiceGrpc.getAnnotateTextMethod) == null) {
synchronized (LanguageServiceGrpc.class) {
if ((getAnnotateTextMethod = LanguageServiceGrpc.getAnnotateTextMethod) == null) {
LanguageServiceGrpc.getAnnotateTextMethod =
getAnnotateTextMethod =
io.grpc.MethodDescriptor
.
newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "AnnotateText"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(
io.grpc.protobuf.ProtoUtils.marshaller(
com.google.cloud.language.v1.AnnotateTextRequest
.getDefaultInstance()))
.setResponseMarshaller(
io.grpc.protobuf.ProtoUtils.marshaller(
com.google.cloud.language.v1.AnnotateTextResponse
.getDefaultInstance()))
.setSchemaDescriptor(
new LanguageServiceMethodDescriptorSupplier("AnnotateText"))
.build();
}
}
}
return getAnnotateTextMethod;
}
/** Creates a new async stub that supports all call types for the service */
public static LanguageServiceStub newStub(io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory factory =
new io.grpc.stub.AbstractStub.StubFactory() {
@java.lang.Override
public LanguageServiceStub newStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new LanguageServiceStub(channel, callOptions);
}
};
return LanguageServiceStub.newStub(factory, channel);
}
/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
public static LanguageServiceBlockingStub newBlockingStub(io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory factory =
new io.grpc.stub.AbstractStub.StubFactory() {
@java.lang.Override
public LanguageServiceBlockingStub newStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new LanguageServiceBlockingStub(channel, callOptions);
}
};
return LanguageServiceBlockingStub.newStub(factory, channel);
}
/** Creates a new ListenableFuture-style stub that supports unary calls on the service */
public static LanguageServiceFutureStub newFutureStub(io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory factory =
new io.grpc.stub.AbstractStub.StubFactory() {
@java.lang.Override
public LanguageServiceFutureStub newStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new LanguageServiceFutureStub(channel, callOptions);
}
};
return LanguageServiceFutureStub.newStub(factory, channel);
}
/**
*
*
*
* Provides text analysis operations such as sentiment analysis and entity
* recognition.
*
*/
public interface AsyncService {
/**
*
*
*
* Analyzes the sentiment of the provided text.
*
*/
default void analyzeSentiment(
com.google.cloud.language.v1.AnalyzeSentimentRequest request,
io.grpc.stub.StreamObserver
responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(
getAnalyzeSentimentMethod(), responseObserver);
}
/**
*
*
*
* Finds named entities (currently proper names and common nouns) in the text
* along with entity types, salience, mentions for each entity, and
* other properties.
*
*/
default void analyzeEntities(
com.google.cloud.language.v1.AnalyzeEntitiesRequest request,
io.grpc.stub.StreamObserver
responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(
getAnalyzeEntitiesMethod(), responseObserver);
}
/**
*
*
*
* Finds entities, similar to
* [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities]
* in the text and analyzes sentiment associated with each entity and its
* mentions.
*
*/
default void analyzeEntitySentiment(
com.google.cloud.language.v1.AnalyzeEntitySentimentRequest request,
io.grpc.stub.StreamObserver
responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(
getAnalyzeEntitySentimentMethod(), responseObserver);
}
/**
*
*
*
* Analyzes the syntax of the text and provides sentence boundaries and
* tokenization along with part of speech tags, dependency trees, and other
* properties.
*
*/
default void analyzeSyntax(
com.google.cloud.language.v1.AnalyzeSyntaxRequest request,
io.grpc.stub.StreamObserver
responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(
getAnalyzeSyntaxMethod(), responseObserver);
}
/**
*
*
*
* Classifies a document into categories.
*
*/
default void classifyText(
com.google.cloud.language.v1.ClassifyTextRequest request,
io.grpc.stub.StreamObserver
responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(
getClassifyTextMethod(), responseObserver);
}
/**
*
*
*
* Moderates a document for harmful and sensitive categories.
*
*/
default void moderateText(
com.google.cloud.language.v1.ModerateTextRequest request,
io.grpc.stub.StreamObserver
responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(
getModerateTextMethod(), responseObserver);
}
/**
*
*
*
* A convenience method that provides all the features that analyzeSentiment,
* analyzeEntities, and analyzeSyntax provide in one call.
*
*/
default void annotateText(
com.google.cloud.language.v1.AnnotateTextRequest request,
io.grpc.stub.StreamObserver
responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(
getAnnotateTextMethod(), responseObserver);
}
}
/**
* Base class for the server implementation of the service LanguageService.
*
*
* Provides text analysis operations such as sentiment analysis and entity
* recognition.
*
*/
public abstract static class LanguageServiceImplBase
implements io.grpc.BindableService, AsyncService {
@java.lang.Override
public final io.grpc.ServerServiceDefinition bindService() {
return LanguageServiceGrpc.bindService(this);
}
}
/**
* A stub to allow clients to do asynchronous rpc calls to service LanguageService.
*
*
* Provides text analysis operations such as sentiment analysis and entity
* recognition.
*
*/
public static final class LanguageServiceStub
extends io.grpc.stub.AbstractAsyncStub {
private LanguageServiceStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected LanguageServiceStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new LanguageServiceStub(channel, callOptions);
}
/**
*
*
*
* Analyzes the sentiment of the provided text.
*
*/
public void analyzeSentiment(
com.google.cloud.language.v1.AnalyzeSentimentRequest request,
io.grpc.stub.StreamObserver
responseObserver) {
io.grpc.stub.ClientCalls.asyncUnaryCall(
getChannel().newCall(getAnalyzeSentimentMethod(), getCallOptions()),
request,
responseObserver);
}
/**
*
*
*
* Finds named entities (currently proper names and common nouns) in the text
* along with entity types, salience, mentions for each entity, and
* other properties.
*
*/
public void analyzeEntities(
com.google.cloud.language.v1.AnalyzeEntitiesRequest request,
io.grpc.stub.StreamObserver
responseObserver) {
io.grpc.stub.ClientCalls.asyncUnaryCall(
getChannel().newCall(getAnalyzeEntitiesMethod(), getCallOptions()),
request,
responseObserver);
}
/**
*
*
*
* Finds entities, similar to
* [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities]
* in the text and analyzes sentiment associated with each entity and its
* mentions.
*
*/
public void analyzeEntitySentiment(
com.google.cloud.language.v1.AnalyzeEntitySentimentRequest request,
io.grpc.stub.StreamObserver
responseObserver) {
io.grpc.stub.ClientCalls.asyncUnaryCall(
getChannel().newCall(getAnalyzeEntitySentimentMethod(), getCallOptions()),
request,
responseObserver);
}
/**
*
*
*
* Analyzes the syntax of the text and provides sentence boundaries and
* tokenization along with part of speech tags, dependency trees, and other
* properties.
*
*/
public void analyzeSyntax(
com.google.cloud.language.v1.AnalyzeSyntaxRequest request,
io.grpc.stub.StreamObserver
responseObserver) {
io.grpc.stub.ClientCalls.asyncUnaryCall(
getChannel().newCall(getAnalyzeSyntaxMethod(), getCallOptions()),
request,
responseObserver);
}
/**
*
*
*
* Classifies a document into categories.
*
*/
public void classifyText(
com.google.cloud.language.v1.ClassifyTextRequest request,
io.grpc.stub.StreamObserver
responseObserver) {
io.grpc.stub.ClientCalls.asyncUnaryCall(
getChannel().newCall(getClassifyTextMethod(), getCallOptions()),
request,
responseObserver);
}
/**
*
*
*
* Moderates a document for harmful and sensitive categories.
*
*/
public void moderateText(
com.google.cloud.language.v1.ModerateTextRequest request,
io.grpc.stub.StreamObserver
responseObserver) {
io.grpc.stub.ClientCalls.asyncUnaryCall(
getChannel().newCall(getModerateTextMethod(), getCallOptions()),
request,
responseObserver);
}
/**
*
*
*
* A convenience method that provides all the features that analyzeSentiment,
* analyzeEntities, and analyzeSyntax provide in one call.
*
*/
public void annotateText(
com.google.cloud.language.v1.AnnotateTextRequest request,
io.grpc.stub.StreamObserver
responseObserver) {
io.grpc.stub.ClientCalls.asyncUnaryCall(
getChannel().newCall(getAnnotateTextMethod(), getCallOptions()),
request,
responseObserver);
}
}
/**
* A stub to allow clients to do synchronous rpc calls to service LanguageService.
*
*
* Provides text analysis operations such as sentiment analysis and entity
* recognition.
*
*/
public static final class LanguageServiceBlockingStub
extends io.grpc.stub.AbstractBlockingStub {
private LanguageServiceBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected LanguageServiceBlockingStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new LanguageServiceBlockingStub(channel, callOptions);
}
/**
*
*
*
* Analyzes the sentiment of the provided text.
*
*/
public com.google.cloud.language.v1.AnalyzeSentimentResponse analyzeSentiment(
com.google.cloud.language.v1.AnalyzeSentimentRequest request) {
return io.grpc.stub.ClientCalls.blockingUnaryCall(
getChannel(), getAnalyzeSentimentMethod(), getCallOptions(), request);
}
/**
*
*
*
* Finds named entities (currently proper names and common nouns) in the text
* along with entity types, salience, mentions for each entity, and
* other properties.
*
*/
public com.google.cloud.language.v1.AnalyzeEntitiesResponse analyzeEntities(
com.google.cloud.language.v1.AnalyzeEntitiesRequest request) {
return io.grpc.stub.ClientCalls.blockingUnaryCall(
getChannel(), getAnalyzeEntitiesMethod(), getCallOptions(), request);
}
/**
*
*
*
* Finds entities, similar to
* [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities]
* in the text and analyzes sentiment associated with each entity and its
* mentions.
*
*/
public com.google.cloud.language.v1.AnalyzeEntitySentimentResponse analyzeEntitySentiment(
com.google.cloud.language.v1.AnalyzeEntitySentimentRequest request) {
return io.grpc.stub.ClientCalls.blockingUnaryCall(
getChannel(), getAnalyzeEntitySentimentMethod(), getCallOptions(), request);
}
/**
*
*
*
* Analyzes the syntax of the text and provides sentence boundaries and
* tokenization along with part of speech tags, dependency trees, and other
* properties.
*
*/
public com.google.cloud.language.v1.AnalyzeSyntaxResponse analyzeSyntax(
com.google.cloud.language.v1.AnalyzeSyntaxRequest request) {
return io.grpc.stub.ClientCalls.blockingUnaryCall(
getChannel(), getAnalyzeSyntaxMethod(), getCallOptions(), request);
}
/**
*
*
*
* Classifies a document into categories.
*
*/
public com.google.cloud.language.v1.ClassifyTextResponse classifyText(
com.google.cloud.language.v1.ClassifyTextRequest request) {
return io.grpc.stub.ClientCalls.blockingUnaryCall(
getChannel(), getClassifyTextMethod(), getCallOptions(), request);
}
/**
*
*
*
* Moderates a document for harmful and sensitive categories.
*
*/
public com.google.cloud.language.v1.ModerateTextResponse moderateText(
com.google.cloud.language.v1.ModerateTextRequest request) {
return io.grpc.stub.ClientCalls.blockingUnaryCall(
getChannel(), getModerateTextMethod(), getCallOptions(), request);
}
/**
*
*
*
* A convenience method that provides all the features that analyzeSentiment,
* analyzeEntities, and analyzeSyntax provide in one call.
*
*/
public com.google.cloud.language.v1.AnnotateTextResponse annotateText(
com.google.cloud.language.v1.AnnotateTextRequest request) {
return io.grpc.stub.ClientCalls.blockingUnaryCall(
getChannel(), getAnnotateTextMethod(), getCallOptions(), request);
}
}
/**
* A stub to allow clients to do ListenableFuture-style rpc calls to service LanguageService.
*
*
* Provides text analysis operations such as sentiment analysis and entity
* recognition.
*
*/
public static final class LanguageServiceFutureStub
extends io.grpc.stub.AbstractFutureStub {
private LanguageServiceFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected LanguageServiceFutureStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new LanguageServiceFutureStub(channel, callOptions);
}
/**
*
*
*
* Analyzes the sentiment of the provided text.
*
*/
public com.google.common.util.concurrent.ListenableFuture<
com.google.cloud.language.v1.AnalyzeSentimentResponse>
analyzeSentiment(com.google.cloud.language.v1.AnalyzeSentimentRequest request) {
return io.grpc.stub.ClientCalls.futureUnaryCall(
getChannel().newCall(getAnalyzeSentimentMethod(), getCallOptions()), request);
}
/**
*
*
*
* Finds named entities (currently proper names and common nouns) in the text
* along with entity types, salience, mentions for each entity, and
* other properties.
*
*/
public com.google.common.util.concurrent.ListenableFuture<
com.google.cloud.language.v1.AnalyzeEntitiesResponse>
analyzeEntities(com.google.cloud.language.v1.AnalyzeEntitiesRequest request) {
return io.grpc.stub.ClientCalls.futureUnaryCall(
getChannel().newCall(getAnalyzeEntitiesMethod(), getCallOptions()), request);
}
/**
*
*
*
* Finds entities, similar to
* [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities]
* in the text and analyzes sentiment associated with each entity and its
* mentions.
*
*/
public com.google.common.util.concurrent.ListenableFuture<
com.google.cloud.language.v1.AnalyzeEntitySentimentResponse>
analyzeEntitySentiment(com.google.cloud.language.v1.AnalyzeEntitySentimentRequest request) {
return io.grpc.stub.ClientCalls.futureUnaryCall(
getChannel().newCall(getAnalyzeEntitySentimentMethod(), getCallOptions()), request);
}
/**
*
*
*
* Analyzes the syntax of the text and provides sentence boundaries and
* tokenization along with part of speech tags, dependency trees, and other
* properties.
*
*/
public com.google.common.util.concurrent.ListenableFuture<
com.google.cloud.language.v1.AnalyzeSyntaxResponse>
analyzeSyntax(com.google.cloud.language.v1.AnalyzeSyntaxRequest request) {
return io.grpc.stub.ClientCalls.futureUnaryCall(
getChannel().newCall(getAnalyzeSyntaxMethod(), getCallOptions()), request);
}
/**
*
*
*
* Classifies a document into categories.
*
*/
public com.google.common.util.concurrent.ListenableFuture<
com.google.cloud.language.v1.ClassifyTextResponse>
classifyText(com.google.cloud.language.v1.ClassifyTextRequest request) {
return io.grpc.stub.ClientCalls.futureUnaryCall(
getChannel().newCall(getClassifyTextMethod(), getCallOptions()), request);
}
/**
*
*
*
* Moderates a document for harmful and sensitive categories.
*
*/
public com.google.common.util.concurrent.ListenableFuture<
com.google.cloud.language.v1.ModerateTextResponse>
moderateText(com.google.cloud.language.v1.ModerateTextRequest request) {
return io.grpc.stub.ClientCalls.futureUnaryCall(
getChannel().newCall(getModerateTextMethod(), getCallOptions()), request);
}
/**
*
*
*
* A convenience method that provides all the features that analyzeSentiment,
* analyzeEntities, and analyzeSyntax provide in one call.
*
*/
public com.google.common.util.concurrent.ListenableFuture<
com.google.cloud.language.v1.AnnotateTextResponse>
annotateText(com.google.cloud.language.v1.AnnotateTextRequest request) {
return io.grpc.stub.ClientCalls.futureUnaryCall(
getChannel().newCall(getAnnotateTextMethod(), getCallOptions()), request);
}
}
private static final int METHODID_ANALYZE_SENTIMENT = 0;
private static final int METHODID_ANALYZE_ENTITIES = 1;
private static final int METHODID_ANALYZE_ENTITY_SENTIMENT = 2;
private static final int METHODID_ANALYZE_SYNTAX = 3;
private static final int METHODID_CLASSIFY_TEXT = 4;
private static final int METHODID_MODERATE_TEXT = 5;
private static final int METHODID_ANNOTATE_TEXT = 6;
private static final class MethodHandlers
implements io.grpc.stub.ServerCalls.UnaryMethod,
io.grpc.stub.ServerCalls.ServerStreamingMethod,
io.grpc.stub.ServerCalls.ClientStreamingMethod,
io.grpc.stub.ServerCalls.BidiStreamingMethod {
private final AsyncService serviceImpl;
private final int methodId;
MethodHandlers(AsyncService serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) {
switch (methodId) {
case METHODID_ANALYZE_SENTIMENT:
serviceImpl.analyzeSentiment(
(com.google.cloud.language.v1.AnalyzeSentimentRequest) request,
(io.grpc.stub.StreamObserver)
responseObserver);
break;
case METHODID_ANALYZE_ENTITIES:
serviceImpl.analyzeEntities(
(com.google.cloud.language.v1.AnalyzeEntitiesRequest) request,
(io.grpc.stub.StreamObserver)
responseObserver);
break;
case METHODID_ANALYZE_ENTITY_SENTIMENT:
serviceImpl.analyzeEntitySentiment(
(com.google.cloud.language.v1.AnalyzeEntitySentimentRequest) request,
(io.grpc.stub.StreamObserver<
com.google.cloud.language.v1.AnalyzeEntitySentimentResponse>)
responseObserver);
break;
case METHODID_ANALYZE_SYNTAX:
serviceImpl.analyzeSyntax(
(com.google.cloud.language.v1.AnalyzeSyntaxRequest) request,
(io.grpc.stub.StreamObserver)
responseObserver);
break;
case METHODID_CLASSIFY_TEXT:
serviceImpl.classifyText(
(com.google.cloud.language.v1.ClassifyTextRequest) request,
(io.grpc.stub.StreamObserver)
responseObserver);
break;
case METHODID_MODERATE_TEXT:
serviceImpl.moderateText(
(com.google.cloud.language.v1.ModerateTextRequest) request,
(io.grpc.stub.StreamObserver)
responseObserver);
break;
case METHODID_ANNOTATE_TEXT:
serviceImpl.annotateText(
(com.google.cloud.language.v1.AnnotateTextRequest) request,
(io.grpc.stub.StreamObserver)
responseObserver);
break;
default:
throw new AssertionError();
}
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public io.grpc.stub.StreamObserver invoke(
io.grpc.stub.StreamObserver responseObserver) {
switch (methodId) {
default:
throw new AssertionError();
}
}
}
public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getAnalyzeSentimentMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
com.google.cloud.language.v1.AnalyzeSentimentRequest,
com.google.cloud.language.v1.AnalyzeSentimentResponse>(
service, METHODID_ANALYZE_SENTIMENT)))
.addMethod(
getAnalyzeEntitiesMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
com.google.cloud.language.v1.AnalyzeEntitiesRequest,
com.google.cloud.language.v1.AnalyzeEntitiesResponse>(
service, METHODID_ANALYZE_ENTITIES)))
.addMethod(
getAnalyzeEntitySentimentMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
com.google.cloud.language.v1.AnalyzeEntitySentimentRequest,
com.google.cloud.language.v1.AnalyzeEntitySentimentResponse>(
service, METHODID_ANALYZE_ENTITY_SENTIMENT)))
.addMethod(
getAnalyzeSyntaxMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
com.google.cloud.language.v1.AnalyzeSyntaxRequest,
com.google.cloud.language.v1.AnalyzeSyntaxResponse>(
service, METHODID_ANALYZE_SYNTAX)))
.addMethod(
getClassifyTextMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
com.google.cloud.language.v1.ClassifyTextRequest,
com.google.cloud.language.v1.ClassifyTextResponse>(
service, METHODID_CLASSIFY_TEXT)))
.addMethod(
getModerateTextMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
com.google.cloud.language.v1.ModerateTextRequest,
com.google.cloud.language.v1.ModerateTextResponse>(
service, METHODID_MODERATE_TEXT)))
.addMethod(
getAnnotateTextMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
com.google.cloud.language.v1.AnnotateTextRequest,
com.google.cloud.language.v1.AnnotateTextResponse>(
service, METHODID_ANNOTATE_TEXT)))
.build();
}
private abstract static class LanguageServiceBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoFileDescriptorSupplier,
io.grpc.protobuf.ProtoServiceDescriptorSupplier {
LanguageServiceBaseDescriptorSupplier() {}
@java.lang.Override
public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
return com.google.cloud.language.v1.LanguageServiceProto.getDescriptor();
}
@java.lang.Override
public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
return getFileDescriptor().findServiceByName("LanguageService");
}
}
private static final class LanguageServiceFileDescriptorSupplier
extends LanguageServiceBaseDescriptorSupplier {
LanguageServiceFileDescriptorSupplier() {}
}
private static final class LanguageServiceMethodDescriptorSupplier
extends LanguageServiceBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
private final java.lang.String methodName;
LanguageServiceMethodDescriptorSupplier(java.lang.String methodName) {
this.methodName = methodName;
}
@java.lang.Override
public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
return getServiceDescriptor().findMethodByName(methodName);
}
}
private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
public static io.grpc.ServiceDescriptor getServiceDescriptor() {
io.grpc.ServiceDescriptor result = serviceDescriptor;
if (result == null) {
synchronized (LanguageServiceGrpc.class) {
result = serviceDescriptor;
if (result == null) {
serviceDescriptor =
result =
io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
.setSchemaDescriptor(new LanguageServiceFileDescriptorSupplier())
.addMethod(getAnalyzeSentimentMethod())
.addMethod(getAnalyzeEntitiesMethod())
.addMethod(getAnalyzeEntitySentimentMethod())
.addMethod(getAnalyzeSyntaxMethod())
.addMethod(getClassifyTextMethod())
.addMethod(getModerateTextMethod())
.addMethod(getAnnotateTextMethod())
.build();
}
}
}
return result;
}
}