transcribe

package
v0.0.0-...-3d89718 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GoogleTrStream

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

GoogleTrStream implements the transcribe.Stream interface, it should map one to one with the audio stream coming from the client

func (*GoogleTrStream) Close

func (st *GoogleTrStream) Close() error

Close flushes the recognition stream and pipes the results to the channel

func (*GoogleTrStream) Results

func (st *GoogleTrStream) Results() <-chan Result

Results returns a channel that will receive the transcription results when they're ready

func (*GoogleTrStream) Write

func (st *GoogleTrStream) Write(buffer []byte) (int, error)

type GoogleTranscriber

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

GoogleTranscriber is the implementation of the transcribe.Service, hold a pointer to the Google Speech client

func (*GoogleTranscriber) CreateStream

func (t *GoogleTranscriber) CreateStream() (Stream, error)

CreateStream creates a new transcription stream

type Result

type Result struct {
	Text       string  `json:"text"`
	Confidence float32 `json:"confidence"`
	Final      bool    `json:"final"`
}

Result is the struct used to serialize the results back to the client

type Service

type Service interface {
	CreateStream() (Stream, error)
}

Service is an abstract representation of the transcription service

func NewGoogleSpeech

func NewGoogleSpeech(ctx context.Context, credentials string) (Service, error)

NewGoogleSpeech creates a new intances of the transcribe.Service that uses Google Speech

type Stream

type Stream interface {
	io.Writer
	io.Closer
	Results() <-chan Result
}

Stream is an abstract representation of a transcription stream

Jump to

Keyboard shortcuts

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