Documentation ¶
Overview ¶
Package textclassification provides a generic definition of a simple gRPC service for text classification.
Index ¶
- Variables
- func RegisterClassifierServer(s grpc.ServiceRegistrar, srv ClassifierServer)
- type Class
- type ClassifierClient
- type ClassifierServer
- type ClassifyTextReply
- type ClassifyTextRequest
- func (*ClassifyTextRequest) Descriptor() ([]byte, []int)deprecated
- func (x *ClassifyTextRequest) GetText() string
- func (*ClassifyTextRequest) ProtoMessage()
- func (x *ClassifyTextRequest) ProtoReflect() protoreflect.Message
- func (x *ClassifyTextRequest) Reset()
- func (x *ClassifyTextRequest) String() string
- type UnimplementedClassifierServer
- type UnsafeClassifierServer
Constants ¶
This section is empty.
Variables ¶
var Classifier_ServiceDesc = grpc.ServiceDesc{ ServiceName: "textclassification.Classifier", HandlerType: (*ClassifierServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "ClassifyText", Handler: _Classifier_ClassifyText_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "textclassification.proto", }
Classifier_ServiceDesc is the grpc.ServiceDesc for Classifier service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_textclassification_proto protoreflect.FileDescriptor
Functions ¶
func RegisterClassifierServer ¶
func RegisterClassifierServer(s grpc.ServiceRegistrar, srv ClassifierServer)
Types ¶
type Class ¶
type Class struct { // A label describing the type of this class (e.g. "sentiment"). Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` // A label representing the actual class (e.g. "positive" or "negative"). Label string `protobuf:"bytes,2,opt,name=label,proto3" json:"label,omitempty"` // Prediction confidence, for example in case of a machine-learning system // being used. It should be a number between 0 and 1. Confidence float32 `protobuf:"fixed32,3,opt,name=confidence,proto3" json:"confidence,omitempty"` // contains filtered or unexported fields }
Class is a single text classification result.
func (*Class) Descriptor
deprecated
func (*Class) GetConfidence ¶
func (*Class) ProtoMessage ¶
func (*Class) ProtoMessage()
func (*Class) ProtoReflect ¶
func (x *Class) ProtoReflect() protoreflect.Message
type ClassifierClient ¶
type ClassifierClient interface { // ClassifyText classifies a given text. ClassifyText(ctx context.Context, in *ClassifyTextRequest, opts ...grpc.CallOption) (*ClassifyTextReply, error) }
ClassifierClient is the client API for Classifier service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewClassifierClient ¶
func NewClassifierClient(cc grpc.ClientConnInterface) ClassifierClient
type ClassifierServer ¶
type ClassifierServer interface { // ClassifyText classifies a given text. ClassifyText(context.Context, *ClassifyTextRequest) (*ClassifyTextReply, error) // contains filtered or unexported methods }
ClassifierServer is the server API for Classifier service. All implementations must embed UnimplementedClassifierServer for forward compatibility
type ClassifyTextReply ¶
type ClassifyTextReply struct { // List of text classification results. Classes []*Class `protobuf:"bytes,1,rep,name=classes,proto3" json:"classes,omitempty"` // contains filtered or unexported fields }
ClassifyTextRequest is the response for text classification.
func (*ClassifyTextReply) Descriptor
deprecated
func (*ClassifyTextReply) Descriptor() ([]byte, []int)
Deprecated: Use ClassifyTextReply.ProtoReflect.Descriptor instead.
func (*ClassifyTextReply) GetClasses ¶
func (x *ClassifyTextReply) GetClasses() []*Class
func (*ClassifyTextReply) ProtoMessage ¶
func (*ClassifyTextReply) ProtoMessage()
func (*ClassifyTextReply) ProtoReflect ¶
func (x *ClassifyTextReply) ProtoReflect() protoreflect.Message
func (*ClassifyTextReply) Reset ¶
func (x *ClassifyTextReply) Reset()
func (*ClassifyTextReply) String ¶
func (x *ClassifyTextReply) String() string
type ClassifyTextRequest ¶
type ClassifyTextRequest struct { // The text to be classified. Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"` // contains filtered or unexported fields }
ClassifyTextRequest is the request for text classification.
func (*ClassifyTextRequest) Descriptor
deprecated
func (*ClassifyTextRequest) Descriptor() ([]byte, []int)
Deprecated: Use ClassifyTextRequest.ProtoReflect.Descriptor instead.
func (*ClassifyTextRequest) GetText ¶
func (x *ClassifyTextRequest) GetText() string
func (*ClassifyTextRequest) ProtoMessage ¶
func (*ClassifyTextRequest) ProtoMessage()
func (*ClassifyTextRequest) ProtoReflect ¶
func (x *ClassifyTextRequest) ProtoReflect() protoreflect.Message
func (*ClassifyTextRequest) Reset ¶
func (x *ClassifyTextRequest) Reset()
func (*ClassifyTextRequest) String ¶
func (x *ClassifyTextRequest) String() string
type UnimplementedClassifierServer ¶
type UnimplementedClassifierServer struct { }
UnimplementedClassifierServer must be embedded to have forward compatible implementations.
func (UnimplementedClassifierServer) ClassifyText ¶
func (UnimplementedClassifierServer) ClassifyText(context.Context, *ClassifyTextRequest) (*ClassifyTextReply, error)
type UnsafeClassifierServer ¶
type UnsafeClassifierServer interface {
// contains filtered or unexported methods
}
UnsafeClassifierServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ClassifierServer will result in compilation errors.