Documentation
¶
Index ¶
- Constants
- Variables
- func GetAPIBaseURL() string
- func ProgressStageCN(stage ProgressStage) string
- func SetAPIBaseURL(url string)
- type ASRResponse
- type ASRResult
- type ProgressCallback
- type ProgressInfo
- type ProgressStage
- type ResourceCompleteResponse
- type ResourceCreateResponse
- type ResultState
- type TaskCreateResponse
- type TaskResultResponse
- type Utterance
- type Words
Constants ¶
View Source
const ( APIReqUpload = "/resource/create" APICommitUpload = "/resource/create/complete" APICreateTask = "/task" APIQueryResult = "/task/result" )
Variables ¶
View Source
var ( SupportedInputFormats = []string{"flac", "aac", "m4a", "mp3", "wav"} SupportedOutputFormats = []string{"srt", "json", "lrc", "txt"} )
Functions ¶
Types ¶
type ASRResponse ¶
type ASRResponse struct {
Code int `json:"code"`
Message string `json:"message"`
Data interface{} `json:"data"`
}
ASRResponse 定义API响应结构
type ASRResult ¶
type ASRResult struct {
Utterances []Utterance `json:"utterances"`
Version string `json:"version"`
}
ASRResult 定义识别结果
type ProgressInfo ¶
type ProgressInfo struct {
Stage ProgressStage // 当前阶段
Total int // 总进度(100)
Current int // 当前进度(0-100)
Description string // 当前状态描述
}
ProgressInfo 进度信息
type ProgressStage ¶
type ProgressStage string
ProgressStage 进度阶段
const ( StageInit ProgressStage = "init" // 初始化 StageUpload ProgressStage = "upload" // 上传文件 StageProcess ProgressStage = "process" // 语音识别 StageComplete ProgressStage = "complete" // 完成 )
type ResourceCompleteResponse ¶
type ResourceCompleteResponse struct {
ResourceID string `json:"resource_id"`
DownloadURL string `json:"download_url"`
}
ResourceCompleteResponse 定义上传完成响应
type ResourceCreateResponse ¶
type ResourceCreateResponse struct {
ResourceID string `json:"resource_id"`
Title string `json:"title"`
Type int `json:"type"`
InBossKey string `json:"in_boss_key"`
Size int64 `json:"size"`
UploadURLs []string `json:"upload_urls"`
UploadID string `json:"upload_id"`
PerSize int `json:"per_size"`
}
ResourceCreateResponse 定义上传请响应
type ResultState ¶
type ResultState int
const ( StateStop ResultState = 0 StateRunning ResultState = 1 StateError ResultState = 3 StateComplete ResultState = 4 )
type TaskCreateResponse ¶
type TaskCreateResponse struct {
Resource string `json:"resource"`
Result string `json:"result"`
TaskID string `json:"task_id"`
}
TaskCreateResponse 定义任务创建响应
type TaskResultResponse ¶
type TaskResultResponse struct {
TaskID string `json:"task_id"`
Result string `json:"result"`
Remark string `json:"remark"`
State ResultState `json:"state"`
}
TaskResultResponse 义任务结果响应
Click to show internal directories.
Click to hide internal directories.