Documentation ¶
Overview ¶
package common 一些有用的通用功能函数库
Index ¶
- Variables
- func Base64ToBytes(base64Data string) []byte
- func BytesToBase64(bytesData []byte) string
- func ReadBinFile(filename string) []byte
- func SaveWaveObject(filename string, wave Wav) error
- func SendHTTPRequest(url string, method string, bytesBody []byte, contentType string) ([]byte, error)
- func SendHTTPRequestGet(url string) ([]byte, error)
- func SendHTTPRequestPost(url string, bytesForm []byte, contentType string) ([]byte, error)
- func URLDecode(text string) string
- func URLEncode(text string) string
- type AsrtAPILanguageRequest
- type AsrtAPIResponse
- type AsrtAPISpeechRequest
- type Wav
Constants ¶
This section is empty.
Variables ¶
View Source
var ( APIStatusCodeOK int = 200000 // OK APIStatusCodePartOK int = 206000 // 部分识别结果 APIStatusCodeClientError int = 400000 APIStatusCodeClientErrorFormat int = 400001 // 请求数据格式错误 APIStatusCodeClientErrorConfig int = 400002 // 请求数据配置不支持 APIStatusCodeServerError int = 500000 APIStatusCodeServerErrorRunning int = 500001 // 服务器运行中出错 )
Functions ¶
func Base64ToBytes ¶
Base64ToBytes base64编码数据转换为[]byte字节数组
func BytesToBase64 ¶
BytesToBase64 []byte字节数组转换为base64编码数据
func ReadBinFile ¶
func SaveWaveObject ¶
func SendHTTPRequest ¶ added in v1.1.1
func SendHTTPRequest(url string, method string, bytesBody []byte, contentType string, ) ([]byte, error)
SendHTTPRequest 发送HTTP请求
func SendHTTPRequestGet ¶ added in v1.1.0
SendHTTPRequestGet 发送HTTP GET请求
func SendHTTPRequestPost ¶ added in v1.1.0
SendHTTPRequestPost 发送HTTP POST请求
Types ¶
type AsrtAPILanguageRequest ¶ added in v1.1.0
type AsrtAPILanguageRequest struct {
SequencePinyin []string `json:"sequence_pinyin"`
}
AsrtAPILanguageRequest ASRT语音识别API语言模型请求类
type AsrtAPIResponse ¶ added in v1.1.0
type AsrtAPIResponse struct { StatusCode int `json:"status_code"` StatucMesaage string `json:"status_message"` Result interface{} `json:"result"` }
AsrtAPIResponse ASRT语音识别API响应类
type AsrtAPISpeechRequest ¶ added in v1.1.0
type AsrtAPISpeechRequest struct { Samples string `json:"samples"` SampleRate int `json:"sample_rate"` Channels int `json:"channels"` ByteWidth int `json:"byte_width"` }
AsrtAPISpeechRequest ASRT语音识别API语音数据请求类
type Wav ¶
type Wav struct { // Samples 采样样本数据 Samples [][]int16 // FrameRate 采样频率,单位:Hz。例如:16000 / 8000 等 FrameRate int // Channels 声音通道数,单声道为1,立体声为2 Channels int // SampleWidth 采样位深,单位:字节(byte) SampleWidth int // BytesPerSec 比特率,单位:bps BytesPerSec int // contains filtered or unexported fields }
Wav Wav格式结构对象
func NewBlankWav ¶
NewBlankWav 获取一个新的空白Wav对象
Click to show internal directories.
Click to hide internal directories.