asr

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2020 License: Apache-2.0 Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SpeechRecognitionListener

type SpeechRecognitionListener interface {
	OnRecognitionStart(*SpeechRecognitionResponse)
	OnSentenceBegin(*SpeechRecognitionResponse)
	OnRecognitionResultChange(*SpeechRecognitionResponse)
	OnSentenceEnd(*SpeechRecognitionResponse)
	OnRecognitionComplete(*SpeechRecognitionResponse)
	OnFail(*SpeechRecognitionResponse, error)
}

SpeechRecognitionListener is the listener of

type SpeechRecognitionResponse

type SpeechRecognitionResponse struct {
	Code      int                             `json:"code"`
	Message   string                          `json:"message"`
	VoiceID   string                          `json:"voice_id,omitempty"`
	MessageID string                          `json:"message_id,omitempty"`
	Final     uint32                          `json:"final,omitempty"`
	Result    SpeechRecognitionResponseResult `json:"result,omitempty"`
}

SpeechRecognitionResponse is the reponse of asr service

type SpeechRecognitionResponseResult

type SpeechRecognitionResponseResult struct {
	SliceType    uint32                                `json:"slice_type"`
	Index        int                                   `json:"index"`
	StartTime    uint32                                `json:"start_time"`
	EndTime      uint32                                `json:"end_time"`
	VoiceTextStr string                                `json:"voice_text_str"`
	WordSize     uint32                                `json:"word_size"`
	WordList     []SpeechRecognitionResponseResultWord `json:"word_list"`
}

SpeechRecognitionResponseResult SpeechRecognitionResponseResult

type SpeechRecognitionResponseResultWord

type SpeechRecognitionResponseResultWord struct {
	Word       string `json:"word"`
	StartTime  uint32 `json:"start_time"`
	EndTime    uint32 `json:"end_time"`
	StableFlag uint32 `json:"stable_flag"`
}

SpeechRecognitionResponseResultWord SpeechRecognitionResponseResultWord

type SpeechRecognizer

type SpeechRecognizer struct {
	AppID           string
	Credential      *common.Credential
	EngineModelType string
	VoiceFormat     uint32
	NeedVad         uint32
	WordInfo        uint32
	VadSilenceTime  uint32

	ProxyURL string
	// contains filtered or unexported fields
}

SpeechRecognizer is the entry for ASR service

func NewSpeechRecognizer

func NewSpeechRecognizer(appID string, credential *common.Credential, engineModelType string, listener SpeechRecognitionListener) *SpeechRecognizer

NewSpeechRecognizer creates instance of SpeechRecognizer

func (*SpeechRecognizer) Start

func (recognizer *SpeechRecognizer) Start() error

Start connects to server and start a recognition session

func (*SpeechRecognizer) Stop

func (recognizer *SpeechRecognizer) Stop() error

Stop wait for the recognition process to complete

func (*SpeechRecognizer) Write

func (recognizer *SpeechRecognizer) Write(data []byte) error

Jump to

Keyboard shortcuts

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