zeroshotclassification

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2021 License: BSD-2-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Classify

func Classify(
	config configuration.Configuration,
	db *gorm.DB,
	rmq *rabbitmq.Client,
	logger zerolog.Logger,
) error

Classify starts the zero-shot classification workers.

Types

type ClassConfidencePair

type ClassConfidencePair struct {
	Class      string  `json:"class"`
	Confidence float32 `json:"confidence"`
}

ClassConfidencePair is a pair of class and confidence.

type Gateway

type Gateway struct {
	// contains filtered or unexported fields
}

Gateway provides access to spaGO classification API.

func NewGateway

func NewGateway(connection *grpc.ClientConn) *Gateway

NewGateway returns a new Gateway.

func (*Gateway) ClassifyNLI

func (s *Gateway) ClassifyNLI(text, hypothesisTemplate string, possibleLabels []string, multiClass bool) (*ZeroShotClassification, error)

ClassifyNLI performs a zero-shot classification against spaGO API.

func (*Gateway) Close

func (s *Gateway) Close() error

Close closes the connection.

type Worker

type Worker struct {
	// contains filtered or unexported fields
}

Worker is a single worker that performs articles vectorization.

func NewWorker

func NewWorker(
	config configuration.Configuration,
	db *gorm.DB,
	rmq *rabbitmq.Client,
	logger zerolog.Logger,
) (*Worker, error)

NewWorker creates a new Worker.

func (*Worker) Do

func (w *Worker) Do(delivery amqp.Delivery)

Do performs the job of a zero-shot classification worker.

type ZeroShotClassification

type ZeroShotClassification struct {
	Distribution []ClassConfidencePair `json:"distribution"`
}

ZeroShotClassification is the result of a spaGO zero-shot classification.

func (*ZeroShotClassification) Scan

func (z *ZeroShotClassification) Scan(value interface{}) error

Scan implements the Scanner interface.

func (*ZeroShotClassification) Value

func (z *ZeroShotClassification) Value() (driver.Value, error)

Value implements the driver Valuer interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL