recognition

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoTaskFound      = errors.New("no task found")
	ErrNotRecognizeTask = errors.New("not a recognize Task")
)
View Source
var ErrDeviceIsBusy = errors.New("device is busy")
View Source
var ErrNoDeviceBusy = errors.New("no device busy")

Functions

This section is empty.

Types

type Recognition

type Recognition interface {
	Start(ctx context.Context, device, language string) (id, socketPath string, err error)
	Stop(ctx context.Context, id string) error
	Text(ctx context.Context, id string) (string, error)
	Has(id string) bool
}

func NewRecognition

func NewRecognition(
	logger *slog.Logger,
	taskManager *background.TaskManager,
	taskFactory TaskFactory,
) Recognition

type RecognitionMock

type RecognitionMock struct {
	HasMock mRecognitionMockHas

	StartMock mRecognitionMockStart

	StopMock mRecognitionMockStop

	TextMock mRecognitionMockText
	// contains filtered or unexported fields
}

RecognitionMock implements Recognition

func NewRecognitionMock

func NewRecognitionMock(t minimock.Tester) *RecognitionMock

NewRecognitionMock returns a mock for Recognition

func (*RecognitionMock) Has

func (mmHas *RecognitionMock) Has(id string) (b1 bool)

Has implements Recognition

func (*RecognitionMock) HasAfterCounter

func (mmHas *RecognitionMock) HasAfterCounter() uint64

HasAfterCounter returns a count of finished RecognitionMock.Has invocations

func (*RecognitionMock) HasBeforeCounter

func (mmHas *RecognitionMock) HasBeforeCounter() uint64

HasBeforeCounter returns a count of RecognitionMock.Has invocations

func (*RecognitionMock) MinimockFinish

func (m *RecognitionMock) MinimockFinish()

MinimockFinish checks that all mocked methods have been called the expected number of times

func (*RecognitionMock) MinimockHasDone

func (m *RecognitionMock) MinimockHasDone() bool

MinimockHasDone returns true if the count of the Has invocations corresponds the number of defined expectations

func (*RecognitionMock) MinimockHasInspect

func (m *RecognitionMock) MinimockHasInspect()

MinimockHasInspect logs each unmet expectation

func (*RecognitionMock) MinimockStartDone

func (m *RecognitionMock) MinimockStartDone() bool

MinimockStartDone returns true if the count of the Start invocations corresponds the number of defined expectations

func (*RecognitionMock) MinimockStartInspect

func (m *RecognitionMock) MinimockStartInspect()

MinimockStartInspect logs each unmet expectation

func (*RecognitionMock) MinimockStopDone

func (m *RecognitionMock) MinimockStopDone() bool

MinimockStopDone returns true if the count of the Stop invocations corresponds the number of defined expectations

func (*RecognitionMock) MinimockStopInspect

func (m *RecognitionMock) MinimockStopInspect()

MinimockStopInspect logs each unmet expectation

func (*RecognitionMock) MinimockTextDone

func (m *RecognitionMock) MinimockTextDone() bool

MinimockTextDone returns true if the count of the Text invocations corresponds the number of defined expectations

func (*RecognitionMock) MinimockTextInspect

func (m *RecognitionMock) MinimockTextInspect()

MinimockTextInspect logs each unmet expectation

func (*RecognitionMock) MinimockWait

func (m *RecognitionMock) MinimockWait(timeout mm_time.Duration)

MinimockWait waits for all mocked methods to be called the expected number of times

func (*RecognitionMock) Start

func (mmStart *RecognitionMock) Start(ctx context.Context, device string, language string) (id string, socketPath string, err error)

Start implements Recognition

func (*RecognitionMock) StartAfterCounter

func (mmStart *RecognitionMock) StartAfterCounter() uint64

StartAfterCounter returns a count of finished RecognitionMock.Start invocations

func (*RecognitionMock) StartBeforeCounter

func (mmStart *RecognitionMock) StartBeforeCounter() uint64

StartBeforeCounter returns a count of RecognitionMock.Start invocations

func (*RecognitionMock) Stop

func (mmStop *RecognitionMock) Stop(ctx context.Context, id string) (err error)

Stop implements Recognition

func (*RecognitionMock) StopAfterCounter

func (mmStop *RecognitionMock) StopAfterCounter() uint64

StopAfterCounter returns a count of finished RecognitionMock.Stop invocations

func (*RecognitionMock) StopBeforeCounter

func (mmStop *RecognitionMock) StopBeforeCounter() uint64

StopBeforeCounter returns a count of RecognitionMock.Stop invocations

func (*RecognitionMock) Text

func (mmText *RecognitionMock) Text(ctx context.Context, id string) (s1 string, err error)

Text implements Recognition

func (*RecognitionMock) TextAfterCounter

func (mmText *RecognitionMock) TextAfterCounter() uint64

TextAfterCounter returns a count of finished RecognitionMock.Text invocations

func (*RecognitionMock) TextBeforeCounter

func (mmText *RecognitionMock) TextBeforeCounter() uint64

TextBeforeCounter returns a count of RecognitionMock.Text invocations

type RecognitionMockHasExpectation

type RecognitionMockHasExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

RecognitionMockHasExpectation specifies expectation struct of the Recognition.Has

func (*RecognitionMockHasExpectation) Then

Then sets up Recognition.Has return parameters for the expectation previously defined by the When method

type RecognitionMockHasExpectationOrigins

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

RecognitionMockHasOrigins contains origins of expectations of the Recognition.Has

type RecognitionMockHasParamPtrs

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

RecognitionMockHasParamPtrs contains pointers to parameters of the Recognition.Has

type RecognitionMockHasParams

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

RecognitionMockHasParams contains parameters of the Recognition.Has

type RecognitionMockHasResults

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

RecognitionMockHasResults contains results of the Recognition.Has

type RecognitionMockStartExpectation

type RecognitionMockStartExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

RecognitionMockStartExpectation specifies expectation struct of the Recognition.Start

func (*RecognitionMockStartExpectation) Then

func (e *RecognitionMockStartExpectation) Then(id string, socketPath string, err error) *RecognitionMock

Then sets up Recognition.Start return parameters for the expectation previously defined by the When method

type RecognitionMockStartExpectationOrigins

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

RecognitionMockStartOrigins contains origins of expectations of the Recognition.Start

type RecognitionMockStartParamPtrs

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

RecognitionMockStartParamPtrs contains pointers to parameters of the Recognition.Start

type RecognitionMockStartParams

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

RecognitionMockStartParams contains parameters of the Recognition.Start

type RecognitionMockStartResults

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

RecognitionMockStartResults contains results of the Recognition.Start

type RecognitionMockStopExpectation

type RecognitionMockStopExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

RecognitionMockStopExpectation specifies expectation struct of the Recognition.Stop

func (*RecognitionMockStopExpectation) Then

Then sets up Recognition.Stop return parameters for the expectation previously defined by the When method

type RecognitionMockStopExpectationOrigins

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

RecognitionMockStopOrigins contains origins of expectations of the Recognition.Stop

type RecognitionMockStopParamPtrs

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

RecognitionMockStopParamPtrs contains pointers to parameters of the Recognition.Stop

type RecognitionMockStopParams

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

RecognitionMockStopParams contains parameters of the Recognition.Stop

type RecognitionMockStopResults

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

RecognitionMockStopResults contains results of the Recognition.Stop

type RecognitionMockTextExpectation

type RecognitionMockTextExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

RecognitionMockTextExpectation specifies expectation struct of the Recognition.Text

func (*RecognitionMockTextExpectation) Then

Then sets up Recognition.Text return parameters for the expectation previously defined by the When method

type RecognitionMockTextExpectationOrigins

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

RecognitionMockTextOrigins contains origins of expectations of the Recognition.Text

type RecognitionMockTextParamPtrs

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

RecognitionMockTextParamPtrs contains pointers to parameters of the Recognition.Text

type RecognitionMockTextParams

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

RecognitionMockTextParams contains parameters of the Recognition.Text

type RecognitionMockTextResults

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

RecognitionMockTextResults contains results of the Recognition.Text

type Task

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

func NewTask

func NewTask(
	logger *slog.Logger,
	audio audio.Audio,
	burner components.BurnerComponent,
	recognize components.RecognizerComponent,
	socket components.SocketComponent,
	output components.OutputComponent,
	device, language, socketPath string,
) *Task

func (*Task) Run

func (t *Task) Run(ctx context.Context) error

func (*Task) SocketPath

func (t *Task) SocketPath() string

func (*Task) Text

func (t *Task) Text() string

type TaskFactory

type TaskFactory interface {
	NewTask(device, language string) *Task
}

type TaskFactoryMock

type TaskFactoryMock struct {
	NewTaskMock mTaskFactoryMockNewTask
	// contains filtered or unexported fields
}

TaskFactoryMock implements TaskFactory

func NewTaskFactoryMock

func NewTaskFactoryMock(t minimock.Tester) *TaskFactoryMock

NewTaskFactoryMock returns a mock for TaskFactory

func (*TaskFactoryMock) MinimockFinish

func (m *TaskFactoryMock) MinimockFinish()

MinimockFinish checks that all mocked methods have been called the expected number of times

func (*TaskFactoryMock) MinimockNewTaskDone

func (m *TaskFactoryMock) MinimockNewTaskDone() bool

MinimockNewTaskDone returns true if the count of the NewTask invocations corresponds the number of defined expectations

func (*TaskFactoryMock) MinimockNewTaskInspect

func (m *TaskFactoryMock) MinimockNewTaskInspect()

MinimockNewTaskInspect logs each unmet expectation

func (*TaskFactoryMock) MinimockWait

func (m *TaskFactoryMock) MinimockWait(timeout mm_time.Duration)

MinimockWait waits for all mocked methods to be called the expected number of times

func (*TaskFactoryMock) NewTask

func (mmNewTask *TaskFactoryMock) NewTask(device string, language string) (tp1 *Task)

NewTask implements TaskFactory

func (*TaskFactoryMock) NewTaskAfterCounter

func (mmNewTask *TaskFactoryMock) NewTaskAfterCounter() uint64

NewTaskAfterCounter returns a count of finished TaskFactoryMock.NewTask invocations

func (*TaskFactoryMock) NewTaskBeforeCounter

func (mmNewTask *TaskFactoryMock) NewTaskBeforeCounter() uint64

NewTaskBeforeCounter returns a count of TaskFactoryMock.NewTask invocations

type TaskFactoryMockNewTaskExpectation

type TaskFactoryMockNewTaskExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

TaskFactoryMockNewTaskExpectation specifies expectation struct of the TaskFactory.NewTask

func (*TaskFactoryMockNewTaskExpectation) Then

Then sets up TaskFactory.NewTask return parameters for the expectation previously defined by the When method

type TaskFactoryMockNewTaskExpectationOrigins

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

TaskFactoryMockNewTaskOrigins contains origins of expectations of the TaskFactory.NewTask

type TaskFactoryMockNewTaskParamPtrs

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

TaskFactoryMockNewTaskParamPtrs contains pointers to parameters of the TaskFactory.NewTask

type TaskFactoryMockNewTaskParams

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

TaskFactoryMockNewTaskParams contains parameters of the TaskFactory.NewTask

type TaskFactoryMockNewTaskResults

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

TaskFactoryMockNewTaskResults contains results of the TaskFactory.NewTask

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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