Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add language code to MatchRequest in GRPCRule #9690

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/**
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler (version 1.50.2)",
value = "by gRPC proto compiler (version 1.56.1)",
comments = "Source: synthesizer.proto")
@io.grpc.stub.annotations.GrpcGenerated
public final class SynthesizeServerGrpc {
Expand Down Expand Up @@ -92,31 +92,32 @@ public SynthesizeServerFutureStub newStub(io.grpc.Channel channel, io.grpc.CallO

/**
*/
public static abstract class SynthesizeServerImplBase implements io.grpc.BindableService {
public interface AsyncService {

/**
*/
public void synthesize(org.languagetool.grpc.Synthesizer.SynthesizeRequest request,
default void synthesize(org.languagetool.grpc.Synthesizer.SynthesizeRequest request,
io.grpc.stub.StreamObserver<org.languagetool.grpc.Synthesizer.SynthesizeResponse> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getSynthesizeMethod(), responseObserver);
}
}

/**
* Base class for the server implementation of the service SynthesizeServer.
*/
public static abstract class SynthesizeServerImplBase
implements io.grpc.BindableService, AsyncService {

@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getSynthesizeMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
org.languagetool.grpc.Synthesizer.SynthesizeRequest,
org.languagetool.grpc.Synthesizer.SynthesizeResponse>(
this, METHODID_SYNTHESIZE)))
.build();
return SynthesizeServerGrpc.bindService(this);
}
}

/**
* A stub to allow clients to do asynchronous rpc calls to service SynthesizeServer.
*/
public static final class SynthesizeServerStub extends io.grpc.stub.AbstractAsyncStub<SynthesizeServerStub> {
public static final class SynthesizeServerStub
extends io.grpc.stub.AbstractAsyncStub<SynthesizeServerStub> {
private SynthesizeServerStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
Expand All @@ -138,8 +139,10 @@ public void synthesize(org.languagetool.grpc.Synthesizer.SynthesizeRequest reque
}

/**
* A stub to allow clients to do synchronous rpc calls to service SynthesizeServer.
*/
public static final class SynthesizeServerBlockingStub extends io.grpc.stub.AbstractBlockingStub<SynthesizeServerBlockingStub> {
public static final class SynthesizeServerBlockingStub
extends io.grpc.stub.AbstractBlockingStub<SynthesizeServerBlockingStub> {
private SynthesizeServerBlockingStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
Expand All @@ -160,8 +163,10 @@ public org.languagetool.grpc.Synthesizer.SynthesizeResponse synthesize(org.langu
}

/**
* A stub to allow clients to do ListenableFuture-style rpc calls to service SynthesizeServer.
*/
public static final class SynthesizeServerFutureStub extends io.grpc.stub.AbstractFutureStub<SynthesizeServerFutureStub> {
public static final class SynthesizeServerFutureStub
extends io.grpc.stub.AbstractFutureStub<SynthesizeServerFutureStub> {
private SynthesizeServerFutureStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
Expand Down Expand Up @@ -189,10 +194,10 @@ private static final class MethodHandlers<Req, Resp> implements
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final SynthesizeServerImplBase serviceImpl;
private final AsyncService serviceImpl;
private final int methodId;

MethodHandlers(SynthesizeServerImplBase serviceImpl, int methodId) {
MethodHandlers(AsyncService serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
Expand Down Expand Up @@ -221,6 +226,18 @@ public io.grpc.stub.StreamObserver<Req> invoke(
}
}

public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getSynthesizeMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
org.languagetool.grpc.Synthesizer.SynthesizeRequest,
org.languagetool.grpc.Synthesizer.SynthesizeResponse>(
service, METHODID_SYNTHESIZE)))
.build();
}

private static abstract class SynthesizeServerBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
SynthesizeServerBaseDescriptorSupplier() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/**
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler (version 1.50.2)",
value = "by gRPC proto compiler (version 1.56.1)",
comments = "Source: bert-lm.proto")
@io.grpc.stub.annotations.GrpcGenerated
public final class BertLmGrpc {
Expand Down Expand Up @@ -123,45 +123,39 @@ public BertLmFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions cal

/**
*/
public static abstract class BertLmImplBase implements io.grpc.BindableService {
public interface AsyncService {

/**
*/
public void score(org.languagetool.languagemodel.bert.grpc.BertLmProto.ScoreRequest request,
default void score(org.languagetool.languagemodel.bert.grpc.BertLmProto.ScoreRequest request,
io.grpc.stub.StreamObserver<org.languagetool.languagemodel.bert.grpc.BertLmProto.BertLmResponse> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getScoreMethod(), responseObserver);
}

/**
*/
public void batchScore(org.languagetool.languagemodel.bert.grpc.BertLmProto.BatchScoreRequest request,
default void batchScore(org.languagetool.languagemodel.bert.grpc.BertLmProto.BatchScoreRequest request,
io.grpc.stub.StreamObserver<org.languagetool.languagemodel.bert.grpc.BertLmProto.BatchBertLmResponse> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getBatchScoreMethod(), responseObserver);
}
}

/**
* Base class for the server implementation of the service BertLm.
*/
public static abstract class BertLmImplBase
implements io.grpc.BindableService, AsyncService {

@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getScoreMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
org.languagetool.languagemodel.bert.grpc.BertLmProto.ScoreRequest,
org.languagetool.languagemodel.bert.grpc.BertLmProto.BertLmResponse>(
this, METHODID_SCORE)))
.addMethod(
getBatchScoreMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
org.languagetool.languagemodel.bert.grpc.BertLmProto.BatchScoreRequest,
org.languagetool.languagemodel.bert.grpc.BertLmProto.BatchBertLmResponse>(
this, METHODID_BATCH_SCORE)))
.build();
return BertLmGrpc.bindService(this);
}
}

/**
* A stub to allow clients to do asynchronous rpc calls to service BertLm.
*/
public static final class BertLmStub extends io.grpc.stub.AbstractAsyncStub<BertLmStub> {
public static final class BertLmStub
extends io.grpc.stub.AbstractAsyncStub<BertLmStub> {
private BertLmStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
Expand Down Expand Up @@ -191,8 +185,10 @@ public void batchScore(org.languagetool.languagemodel.bert.grpc.BertLmProto.Batc
}

/**
* A stub to allow clients to do synchronous rpc calls to service BertLm.
*/
public static final class BertLmBlockingStub extends io.grpc.stub.AbstractBlockingStub<BertLmBlockingStub> {
public static final class BertLmBlockingStub
extends io.grpc.stub.AbstractBlockingStub<BertLmBlockingStub> {
private BertLmBlockingStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
Expand Down Expand Up @@ -220,8 +216,10 @@ public org.languagetool.languagemodel.bert.grpc.BertLmProto.BatchBertLmResponse
}

/**
* A stub to allow clients to do ListenableFuture-style rpc calls to service BertLm.
*/
public static final class BertLmFutureStub extends io.grpc.stub.AbstractFutureStub<BertLmFutureStub> {
public static final class BertLmFutureStub
extends io.grpc.stub.AbstractFutureStub<BertLmFutureStub> {
private BertLmFutureStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
Expand Down Expand Up @@ -258,10 +256,10 @@ private static final class MethodHandlers<Req, Resp> implements
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final BertLmImplBase serviceImpl;
private final AsyncService serviceImpl;
private final int methodId;

MethodHandlers(BertLmImplBase serviceImpl, int methodId) {
MethodHandlers(AsyncService serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
Expand Down Expand Up @@ -294,6 +292,25 @@ public io.grpc.stub.StreamObserver<Req> invoke(
}
}

public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getScoreMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
org.languagetool.languagemodel.bert.grpc.BertLmProto.ScoreRequest,
org.languagetool.languagemodel.bert.grpc.BertLmProto.BertLmResponse>(
service, METHODID_SCORE)))
.addMethod(
getBatchScoreMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
org.languagetool.languagemodel.bert.grpc.BertLmProto.BatchScoreRequest,
org.languagetool.languagemodel.bert.grpc.BertLmProto.BatchBertLmResponse>(
service, METHODID_BATCH_SCORE)))
.build();
}

private static abstract class BertLmBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
BertLmBaseDescriptorSupplier() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ protected RemoteRule.RemoteRequest prepareRequest(List<AnalyzedSentence> sentenc
.subList(offset, Math.min(filteredSentences.size(), offset + batchSize))
.stream().map(GRPCUtils::toGRPC).collect(Collectors.toList()))
.setInputLogging(inputLogging)
.setLanguage(ruleLanguage.getShortCodeWithCountryAndVariant())
.addAllTextSessionID(textSessionId != null ?
ids.subList(offset, Math.min(filteredSentences.size(), offset + batchSize))
: Collections.emptyList())
Expand All @@ -284,6 +285,7 @@ protected RemoteRule.RemoteRequest prepareRequest(List<AnalyzedSentence> sentenc
MLServerProto.MatchRequest req = MLServerProto.MatchRequest.newBuilder()
.addAllSentences(text.subList(offset, Math.min(text.size(), offset + batchSize)))
.setInputLogging(inputLogging)
.setLanguage(ruleLanguage.getShortCodeWithCountryAndVariant())
.addAllTextSessionID(textSessionId != null ?
ids.subList(offset, Math.min(text.size(), offset + batchSize))
: Collections.emptyList())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/**
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler (version 1.50.2)",
value = "by gRPC proto compiler (version 1.56.1)",
comments = "Source: ml_server.proto")
@io.grpc.stub.annotations.GrpcGenerated
public final class MLServerGrpc {
Expand Down Expand Up @@ -123,45 +123,39 @@ public MLServerFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions c

/**
*/
public static abstract class MLServerImplBase implements io.grpc.BindableService {
public interface AsyncService {

/**
*/
public void match(org.languagetool.rules.ml.MLServerProto.MatchRequest request,
default void match(org.languagetool.rules.ml.MLServerProto.MatchRequest request,
io.grpc.stub.StreamObserver<org.languagetool.rules.ml.MLServerProto.MatchResponse> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getMatchMethod(), responseObserver);
}

/**
*/
public void matchAnalyzed(org.languagetool.rules.ml.MLServerProto.AnalyzedMatchRequest request,
default void matchAnalyzed(org.languagetool.rules.ml.MLServerProto.AnalyzedMatchRequest request,
io.grpc.stub.StreamObserver<org.languagetool.rules.ml.MLServerProto.MatchResponse> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getMatchAnalyzedMethod(), responseObserver);
}
}

/**
* Base class for the server implementation of the service MLServer.
*/
public static abstract class MLServerImplBase
implements io.grpc.BindableService, AsyncService {

@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getMatchMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
org.languagetool.rules.ml.MLServerProto.MatchRequest,
org.languagetool.rules.ml.MLServerProto.MatchResponse>(
this, METHODID_MATCH)))
.addMethod(
getMatchAnalyzedMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
org.languagetool.rules.ml.MLServerProto.AnalyzedMatchRequest,
org.languagetool.rules.ml.MLServerProto.MatchResponse>(
this, METHODID_MATCH_ANALYZED)))
.build();
return MLServerGrpc.bindService(this);
}
}

/**
* A stub to allow clients to do asynchronous rpc calls to service MLServer.
*/
public static final class MLServerStub extends io.grpc.stub.AbstractAsyncStub<MLServerStub> {
public static final class MLServerStub
extends io.grpc.stub.AbstractAsyncStub<MLServerStub> {
private MLServerStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
Expand Down Expand Up @@ -191,8 +185,10 @@ public void matchAnalyzed(org.languagetool.rules.ml.MLServerProto.AnalyzedMatchR
}

/**
* A stub to allow clients to do synchronous rpc calls to service MLServer.
*/
public static final class MLServerBlockingStub extends io.grpc.stub.AbstractBlockingStub<MLServerBlockingStub> {
public static final class MLServerBlockingStub
extends io.grpc.stub.AbstractBlockingStub<MLServerBlockingStub> {
private MLServerBlockingStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
Expand Down Expand Up @@ -220,8 +216,10 @@ public org.languagetool.rules.ml.MLServerProto.MatchResponse matchAnalyzed(org.l
}

/**
* A stub to allow clients to do ListenableFuture-style rpc calls to service MLServer.
*/
public static final class MLServerFutureStub extends io.grpc.stub.AbstractFutureStub<MLServerFutureStub> {
public static final class MLServerFutureStub
extends io.grpc.stub.AbstractFutureStub<MLServerFutureStub> {
private MLServerFutureStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
Expand Down Expand Up @@ -258,10 +256,10 @@ private static final class MethodHandlers<Req, Resp> implements
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final MLServerImplBase serviceImpl;
private final AsyncService serviceImpl;
private final int methodId;

MethodHandlers(MLServerImplBase serviceImpl, int methodId) {
MethodHandlers(AsyncService serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
Expand Down Expand Up @@ -294,6 +292,25 @@ public io.grpc.stub.StreamObserver<Req> invoke(
}
}

public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getMatchMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
org.languagetool.rules.ml.MLServerProto.MatchRequest,
org.languagetool.rules.ml.MLServerProto.MatchResponse>(
service, METHODID_MATCH)))
.addMethod(
getMatchAnalyzedMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
org.languagetool.rules.ml.MLServerProto.AnalyzedMatchRequest,
org.languagetool.rules.ml.MLServerProto.MatchResponse>(
service, METHODID_MATCH_ANALYZED)))
.build();
}

private static abstract class MLServerBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
MLServerBaseDescriptorSupplier() {}
Expand Down
Loading