Documentation
¶
Index ¶
- Constants
- type FlashRecognitionRequest
- type FlashRecognitionResponse
- type FlashRecognitionResult
- type FlashRecognitionSentence
- type FlashRecognizer
- type FlashWordData
- type SpeechRecognitionListener
- type SpeechRecognitionResponse
- type SpeechRecognitionResponseResult
- type SpeechRecognitionResponseResultWord
- type SpeechRecognizer
- type VNRecognitionEvent
- type VNRecognitionListener
- type VNRecognitionResponse
- type VNRecognizer
Constants ¶
const ( AudioFormatPCM = 1 AudioFormatSpeex = 4 AudioFormatSilk = 6 AudioFormatMp3 = 8 AudioFormatOpus = 10 AudioFormatWav = 12 AudioFormatM4A = 14 AudioFormatAAC = 16 )
AudioFormat type
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FlashRecognitionRequest ¶ added in v1.0.3
type FlashRecognitionRequest struct { EngineType string `json:"engine_type"` VoiceFormat string `json:"voice_format"` SpeakerDiarization uint32 `json:"speaker_diarization"` HotwordId string `json:"hotword_id"` HotwordList string `json:"hotword_list"` CustomizationId string `json:"customization_id"` FilterDirty int32 `json:"filter_dirty"` FilterModal int32 `json:"filter_modal"` FilterPunc int32 `json:"filter_punc"` ConvertNumMode int32 `json:"convert_num_mode"` WordInfo int32 `json:"word_info"` FirstChannelOnly int32 `json:"first_channel_only"` ReinforceHotword int32 `json:"reinforce_hotword"` SentenceMaxLength int32 `json:"sentence_max_length"` }
FlashRecognitionRequest FlashRecognitionRequest
type FlashRecognitionResponse ¶ added in v1.0.3
type FlashRecognitionResponse struct { RequestId string `json:"request_id"` Code int `json:"code"` Message string `json:"message"` AudioDuration int64 `json:"audio_duration"` FlashResult []*FlashRecognitionResult `json:"flash_result,omitempty"` }
FlashRecognitionResponse FlashRecognitionResponse
type FlashRecognitionResult ¶ added in v1.0.3
type FlashRecognitionResult struct { Text string `json:"text"` ChannelId int32 `json:"channel_id"` SentenceList []*FlashRecognitionSentence `json:"sentence_list,omitempty"` }
FlashRecognitionResult FlashRecognitionResult
type FlashRecognitionSentence ¶ added in v1.0.3
type FlashRecognitionSentence struct { Text string `json:"text"` StartTime uint32 `json:"start_time"` EndTime uint32 `json:"end_time"` SpeakerId int32 `json:"speaker_id"` WordList []*FlashWordData `json:"word_list,omitempty"` }
FlashRecognitionSentence FlashRecognitionSentence
type FlashRecognizer ¶ added in v1.0.3
type FlashRecognizer struct { AppID string //for proxy ProxyURL string Credential *common.Credential }
FlashRecognizer is the entry for ASR flash recognizer
func NewFlashRecognizer ¶ added in v1.0.3
func NewFlashRecognizer(appID string, credential *common.Credential) *FlashRecognizer
NewFlashRecognizer creates instance of FlashRecognizer
func (*FlashRecognizer) Recognize ¶ added in v1.0.3
func (recognizer *FlashRecognizer) Recognize(req *FlashRecognitionRequest, videoData []byte) (*FlashRecognitionResponse, error)
Recognize Recognize
type FlashWordData ¶ added in v1.0.3
type FlashWordData struct { Word string `json:"word"` StartTime uint32 `json:"start_time"` EndTime uint32 `json:"end_time"` StableFlag uint32 `json:"stable_flag"` }
FlashWordData FlashWordData
type SpeechRecognitionListener ¶
type SpeechRecognitionListener interface { OnRecognitionStart(*SpeechRecognitionResponse) OnSentenceBegin(*SpeechRecognitionResponse) OnRecognitionResultChange(*SpeechRecognitionResponse) OnSentenceEnd(*SpeechRecognitionResponse) OnRecognitionComplete(*SpeechRecognitionResponse) OnFail(*SpeechRecognitionResponse, error) }
SpeechRecognitionListener User must impletement it. Get recognition result
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 { //request params AppID string EngineModelType string VoiceFormat int NeedVad int HotwordId string HotwordList string CustomizationId string FilterDirty int FilterModal int FilterPunc int ConvertNumMode int WordInfo int VadSilenceTime int ReinforceHotword int NoiseThreshold float64 FilterEmptyResult int MaxSpeakTime int ReplaceTextId string Credential *common.Credential //uuid for voice VoiceID string //for proxy 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
Write : write data in channel
type VNRecognitionEvent ¶ added in v1.0.13
type VNRecognitionEvent struct {
// contains filtered or unexported fields
}
type VNRecognitionListener ¶ added in v1.0.13
type VNRecognitionListener interface { OnVNRecognitionStart(*VNRecognitionResponse) OnVNRecognitionComplete(*VNRecognitionResponse) OnVNFail(*VNRecognitionResponse, error) }
VNRecognitionListener User must impletement it. Get recognition result
type VNRecognitionResponse ¶ added in v1.0.13
type VNRecognitionResponse 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 uint32 `json:"result"` }
VNRecognitionResponse is the reponse of asr service
type VNRecognizer ¶ added in v1.0.13
type VNRecognizer struct { //request params AppID string VoiceFormat int WaitTime uint32 //等待时长 填0 后台默认30秒 最大60秒 单位毫秒 Credential *common.Credential //uuid for voice VoiceID string //for proxy ProxyURL string // contains filtered or unexported fields }
VNRecognizer is the entry for ASR service
func NewVNRecognizer ¶ added in v1.0.13
func NewVNRecognizer(appID string, credential *common.Credential, listener VNRecognitionListener) *VNRecognizer
NewVNRecognizer creates instance of VNRecognizer
func (*VNRecognizer) Start ¶ added in v1.0.13
func (recognizer *VNRecognizer) Start() error
Start connects to server and start a recognition session
func (*VNRecognizer) Stop ¶ added in v1.0.13
func (recognizer *VNRecognizer) Stop() error
Stop wait for the recognition process to complete