predictor

package
v0.0.0-...-b2170da Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Predictor

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

Predictor is a structure which does tokenization and pass tokenized input with trained model to Classifier

func NewPredictor

func NewPredictor(
	tokenizer TokenizerInterface,
	tokenRepository TokenRepositoryInterface,
	resultsRepository ResultsRepositoryInterface,
) *Predictor

NewPredictor returns a Predictor instance

func (*Predictor) Predict

func (p *Predictor) Predict(brainID int64, text string) (prediction entity.Prediction, err error)

Predict returns prediction based on trained model provided by specified brain

type ResultsRepositoryInterface

type ResultsRepositoryInterface interface {
	GetTrainedModel(brainID int64) (classifier.TrainedModelInterface, error)
}

type TokenRepositoryInterface

type TokenRepositoryInterface interface {
	GetTokenIDs(brainID int64, tokens []string) ([]int64, error)
}

type TokenizerInterface

type TokenizerInterface interface {
	Tokenize(sentence string) []string
}

Jump to

Keyboard shortcuts

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