cli

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: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppInterface

type AppInterface interface {
	BrainList() ([]entity.BrainInterface, error)
	GetBrainByReference(reference string) (entity.BrainInterface, error)
	CreateBrain(name string, description string) (entity.BrainInterface, error)
	DeleteBrain(id int64) error

	Train(brainID int64, samples []entity.Sample) error

	// @TODO Not used, remove from here
	Predict(brainID int64, text string) (prediction entity.Prediction, err error)
	HumanizedPredict(brainID int64, text string) (prediction entity.HumanizedPrediction, err error)

	GetClassByID(classID int64) (entity.ClassInterface, error)
}

AppInterface defines dependeny which is used to declare what CLI interface can perform

type CommandsRunner

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

CommandsRunner contains app and input-output streams

func NewCommandsRunner

func NewCommandsRunner(app AppInterface, in io.Reader, out, err io.Writer) *CommandsRunner

NewCommandsRunner just a simple constructor for CommandsRunner

func (*CommandsRunner) Err

func (runner *CommandsRunner) Err(err error)

Err writes string with trailing line break to the error stream

func (*CommandsRunner) NewCmdAnalyse

func (runner *CommandsRunner) NewCmdAnalyse() *cobra.Command

NewCmdAnalyse returns command which allows to run command”

func (*CommandsRunner) NewCmdBrain

func (runner *CommandsRunner) NewCmdBrain() *cobra.Command

func (*CommandsRunner) NewCmdListen

func (runner *CommandsRunner) NewCmdListen(queueCreator QueueCreator) *cobra.Command

NewCmdListen returns command for a queue listening. @TODO This command should be completely refactored.

func (*CommandsRunner) NewCmdTrain

func (runner *CommandsRunner) NewCmdTrain() *cobra.Command

NewCmdTrain returns command for brain training

func (*CommandsRunner) Out

func (runner *CommandsRunner) Out(s string)

Out writes string with trailing line break to the standard output stream

type Prediction

type Prediction struct {
	Brain       string  `json:"brain"`
	Class       string  `json:"class"`
	Probability float64 `json:"probability"`
}

type QueueCreator

type QueueCreator func() (stan.Conn, string, string)

QueueCreator describes dependency which is used to run-time getting connection to NATS Streaming

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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