Documentation ¶
Index ¶
- Constants
- Variables
- type Chunk
- type ChunkBuffer
- type CommonRequest
- type CommonResponse
- type ConnectionConfig
- type Context
- type Header
- type NlsLogger
- func (l *NlsLogger) Debugf(format string, v ...interface{})
- func (l *NlsLogger) Debugln(v ...interface{})
- func (l *NlsLogger) Fatal(v ...interface{})
- func (l *NlsLogger) Fatalf(format string, v ...interface{})
- func (l *NlsLogger) Fatalln(v ...interface{})
- func (l *NlsLogger) Panic(v ...interface{})
- func (l *NlsLogger) Panicf(format string, v ...interface{})
- func (l *NlsLogger) Print(v ...interface{})
- func (l *NlsLogger) Printf(format string, v ...interface{})
- func (l *NlsLogger) Println(v ...interface{})
- func (l *NlsLogger) SetDebug(debug bool)
- func (l *NlsLogger) SetFlags(flags int)
- func (l *NlsLogger) SetLogSil(sil bool)
- func (l *NlsLogger) SetOutput(w io.Writer)
- func (l *NlsLogger) SetPrefix(prefix string)
- type SDK
- type SpeechRecognition
- type SpeechRecognitionStartParam
- type SpeechSynthesis
- type SpeechSynthesisStartParam
- type SpeechTranscription
- func (st *SpeechTranscription) Ctrl(param map[string]interface{}) error
- func (st *SpeechTranscription) SendAudioData(data []byte) error
- func (st *SpeechTranscription) Shutdown()
- func (st *SpeechTranscription) Start(param SpeechTranscriptionStartParam, extra map[string]interface{}) (chan bool, error)
- func (st *SpeechTranscription) Stop() (chan bool, error)
- type SpeechTranscriptionStartParam
- type TokenResult
- type TokenResultMessage
Constants ¶
View Source
const ( CONNECTED_HANDLER = "CONNECTED_HANDLER" CLOSE_HANDLER = "CLOSE_HANDLER" RAW_HANDLER = "RAW_HANDLER" )
View Source
const ( //namespace field SR_NAMESPACE = "SpeechRecognizer" //name field SR_START_NAME = "StartRecognition" SR_STOP_NAME = "StopRecognition" SR_STARTED_NAME = "RecognitionStarted" SR_RESULT_CHG_NAME = "RecognitionResultChanged" SR_COMPLETED_NAME = "RecognitionCompleted" )
View Source
const ( //namespace field ST_NAMESPACE = "SpeechTranscriber" //name field ST_START_NAME = "StartTranscription" ST_STOP_NAME = "StopTranscription" ST_CTRL_NAME = "ControlTranscriber" ST_STARTED_NAME = "TranscriptionStarted" ST_SENTENCE_BEGIN_NAME = "SentenceBegin" ST_SENTENCE_END_NAME = "SentenceEnd" ST_RESULT_CHG_NAME = "TranscriptionResultChanged" ST_COMPLETED_NAME = "TranscriptionCompleted" )
View Source
const ( //namespace field TTS_NAMESPACE = "SpeechSynthesizer" TTS_LONG_NAMESPACE = "SpeechLongSynthesizer" //name field TTS_START_NAME = "StartSynthesis" TTS_COMPLETED_NAME = "SynthesisCompleted" TTS_METAINFO_NAME = "MetaInfo" )
View Source
const ( SDK_VERSION = "0.0.1fix" SDK_NAME = "nls-go-sdk" SDK_LANGUAGE = "go" //AFORMAT PCM = "pcm" WAV = "wav" OPUS = "opus" OPU = "opu" //token DEFAULT_DISTRIBUTE = "cn-shanghai" DEFAULT_DOMAIN = "nls-meta.cn-shanghai.aliyuncs.com" DEFAULT_VERSION = "2019-02-28" DEFAULT_SEC_WEBSOCKET_KEY = "x3JJHMbDL1EzLkh9GBhXDw==" DEFAULT_SEC_WEBSOCKET_VER = "13" DEFAULT_X_NLS_TOKEN_KEY = "X-NLS-Token" DEFAULT_URL = "wss://nls-gateway.aliyuncs.com/ws/v1" TASK_FAILED_NAME = "TaskFailed" AUDIO_FORMAT_KEY = "format" SAMPLE_RATE_KEY = "sample_rate" ENABLE_INTERMEDIATE_KEY = "enable_intermediate_result" ENABLE_PP_KEY = "enable_punctuation_prediction" ENABLE_ITN_KEY = "enable_inverse_text_normalization" )
Variables ¶
View Source
var DefaultContext = Context{ Sdk: SDK{ Name: SDK_NAME, Version: SDK_VERSION, Language: SDK_LANGUAGE, }, }
Functions ¶
This section is empty.
Types ¶
type ChunkBuffer ¶
type ChunkBuffer struct {
Data []*Chunk
}
func LoadPcmInChunk ¶
func LoadPcmInChunk(r io.Reader, chunkSize int) *ChunkBuffer
type CommonRequest ¶
type CommonResponse ¶
type ConnectionConfig ¶
type ConnectionConfig struct { Url string `json:"url"` Token string `json:"token"` Akid string `json:"akid"` Akkey string `json:"akkey"` Appkey string `json:"appkey"` Rbuffer int `json:"rbuffer"` Wbuffer int `json:"wbuffer"` }
func NewConnectionConfigFromJson ¶
func NewConnectionConfigFromJson(jsonStr string) (*ConnectionConfig, error)
func NewConnectionConfigWithToken ¶
func NewConnectionConfigWithToken(url string, appkey string, token string) *ConnectionConfig
type Context ¶
type Context struct { Sdk SDK `json:"sdk"` App map[string]interface{} `json:"app,omitempty"` System map[string]interface{} `json:"system,omitempty"` Device map[string]interface{} `json:"device,omitempty"` Network map[string]interface{} `json:"network,omitempty"` Geography map[string]interface{} `json:"geography,omitempty"` Bridge map[string]interface{} `json:"bridge,omitempty"` Custom map[string]interface{} `json:"custom,omitempty"` }
type NlsLogger ¶
type NlsLogger struct {
// contains filtered or unexported fields
}
func DefaultNlsLog ¶
func DefaultNlsLog() *NlsLogger
type SpeechRecognition ¶
type SpeechRecognition struct { StartParam map[string]interface{} UserParam interface{} // contains filtered or unexported fields }
func NewSpeechRecognition ¶
func NewSpeechRecognition(config *ConnectionConfig, logger *NlsLogger, taskfailed func(string, interface{}), started func(string, interface{}), resultchanged func(string, interface{}), completed func(string, interface{}), closed func(interface{}), param interface{}) (*SpeechRecognition, error)
func (*SpeechRecognition) SendAudioData ¶
func (sr *SpeechRecognition) SendAudioData(data []byte) error
func (*SpeechRecognition) Shutdown ¶
func (sr *SpeechRecognition) Shutdown()
func (*SpeechRecognition) Start ¶
func (sr *SpeechRecognition) Start(param SpeechRecognitionStartParam, extra map[string]interface{}) (chan bool, error)
func (*SpeechRecognition) Stop ¶
func (sr *SpeechRecognition) Stop() (chan bool, error)
type SpeechRecognitionStartParam ¶
type SpeechRecognitionStartParam struct { Format string `json:"format,omitempty"` SampleRate int `json:"sample_rate,omitempty"` EnableIntermediateResult bool `json:"enable_intermediate_result"` EnablePunctuationPrediction bool `json:"enable_punctuation_prediction"` EnableInverseTextNormalization bool `json:"enable_inverse_text_normalization"` }
func DefaultSpeechRecognitionParam ¶
func DefaultSpeechRecognitionParam() SpeechRecognitionStartParam
type SpeechSynthesis ¶
type SpeechSynthesis struct { StartParam map[string]interface{} UserParam interface{} // contains filtered or unexported fields }
func NewSpeechSynthesis ¶
func NewSpeechSynthesis(config *ConnectionConfig, logger *NlsLogger, realtimeLongText bool, taskfailed func(string, interface{}), synthesisresult func([]byte, interface{}), metainfo func(string, interface{}), completed func(string, interface{}), closed func(interface{}), param interface{}) (*SpeechSynthesis, error)
func (*SpeechSynthesis) Shutdown ¶
func (tts *SpeechSynthesis) Shutdown()
func (*SpeechSynthesis) Start ¶
func (tts *SpeechSynthesis) Start(text string, param SpeechSynthesisStartParam, extra map[string]interface{}) (chan bool, error)
type SpeechSynthesisStartParam ¶
type SpeechSynthesisStartParam struct { Voice string `json:"voice"` Format string `json:"format,omitempty"` SampleRate int `json:"sample_rate,omitempty"` Volume int `json:"volume"` SpeechRate int `json:"speech_rate"` PitchRate int `json:"pitch_rate"` EnableSubtitle bool `json:"enable_subtitle"` }
func DefaultSpeechSynthesisParam ¶
func DefaultSpeechSynthesisParam() SpeechSynthesisStartParam
type SpeechTranscription ¶
type SpeechTranscription struct { StartParam map[string]interface{} UserParam interface{} // contains filtered or unexported fields }
func NewSpeechTranscription ¶
func NewSpeechTranscription(config *ConnectionConfig, logger *NlsLogger, taskfailed func(string, interface{}), started func(string, interface{}), sentencebegin func(string, interface{}), sentenceend func(string, interface{}), resultchanged func(string, interface{}), completed func(string, interface{}), closed func(interface{}), param interface{}) (*SpeechTranscription, error)
func (*SpeechTranscription) Ctrl ¶
func (st *SpeechTranscription) Ctrl(param map[string]interface{}) error
func (*SpeechTranscription) SendAudioData ¶
func (st *SpeechTranscription) SendAudioData(data []byte) error
func (*SpeechTranscription) Shutdown ¶
func (st *SpeechTranscription) Shutdown()
func (*SpeechTranscription) Start ¶
func (st *SpeechTranscription) Start(param SpeechTranscriptionStartParam, extra map[string]interface{}) (chan bool, error)
func (*SpeechTranscription) Stop ¶
func (st *SpeechTranscription) Stop() (chan bool, error)
type SpeechTranscriptionStartParam ¶
type SpeechTranscriptionStartParam struct { Format string `json:"format,omitempty"` SampleRate int `json:"sample_rate,omitempty"` EnableIntermediateResult bool `json:"enable_intermediate_result"` EnablePunctuationPrediction bool `json:"enable_punctuation_prediction"` EnableInverseTextNormalization bool `json:"enable_inverse_text_normalization"` MaxSentenceSilence int `json:"max_sentence_silence,omitempty"` EnableWords bool `json:"enable_words"` }
func DefaultSpeechTranscriptionParam ¶
func DefaultSpeechTranscriptionParam() SpeechTranscriptionStartParam
type TokenResult ¶
type TokenResultMessage ¶
type TokenResultMessage struct { ErrMsg string `json:"ErrMsg"` TokenResult TokenResult `json:"Token"` }
Click to show internal directories.
Click to hide internal directories.