vsh

package
v0.0.0-...-e9349c8 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Argmax

func Argmax(probs []float32) (state libaural2.State, prob float32)

Argmax returns the index of the largest elements of the list.

func Init

func Init(
	reader io.Reader,
	stepInferenceFuncs map[libaural2.VocabName]func(*tf.Tensor) ([]float32, error),
) (result chan map[libaural2.VocabName][]float32,
	dump func() *libaural2.AudioClip,
	err error,
)

Init takes a reader of raw audio, and returns a chan of outputs.

Types

type Action

type Action struct {
	MinActivationProb float32       // don't active when prob is low.
	MaxResetProb      float32       // How low does the prob need to be for the utterance to have ended?
	CoolDownDuration  time.Duration // how long after the utterance can a new utterance start?
	TimeLastCalled    time.Time     // when was the handlerFunc last called?

	HandlerFunction func(prob float32) // the func to be called when activated.
	// contains filtered or unexported fields
}

Action is something that can be done in response a state

func MakeDefaultAction

func MakeDefaultAction(run func()) (action Action)

MakeDefaultAction wraps a func() in an Action with sane defaults.

type EventBroker

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

EventBroker manages the stream of events.

func NewEventBroker

func NewEventBroker(resultsChan chan map[libaural2.VocabName][]float32) (eb EventBroker)

NewEventBroker makes a new event broker from a chan of results

func (*EventBroker) Handle

func (eb *EventBroker) Handle(results map[libaural2.VocabName][]float32)

Handle takes one result and passes it on to the actions

func (*EventBroker) Register

func (eb *EventBroker) Register(vocab libaural2.VocabName, state libaural2.State, name string, action Action)

Register a function to be called

func (*EventBroker) Unregister

func (eb *EventBroker) Unregister(vocab libaural2.VocabName, state libaural2.State, name string)

Unregister the handler

Directories

Path Synopsis
example

Jump to

Keyboard shortcuts

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