/
def.go
62 lines (54 loc) · 1.9 KB
/
def.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package aliyun
// 地域ID,常量内容,请勿改变
const REGION_ID string = "cn-shanghai"
const ENDPOINT_NAME string = "cn-shanghai"
const PRODUCT string = "nls-filetrans"
const DOMAIN string = "filetrans.cn-shanghai.aliyuncs.com"
const API_VERSION string = "2018-08-17"
const POST_REQUEST_ACTION string = "SubmitTask"
const GET_REQUEST_ACTION string = "GetTaskResult"
// 请求参数key
const KEY_APP_KEY string = "appkey"
const KEY_FILE_LINK string = "file_link"
const KEY_VERSION string = "version"
const KEY_ENABLE_WORDS string = "enable_words"
const KEY_MAX_SINGLE_SEGMENT_TIME = "max_single_segment_time"
const KEY_ENABLE_UNIFY_POST = "enable_unify_post"
const KEY_ENABLE_DISFLUENCY = "enable_disfluency"
// 响应参数key
const KEY_TASK string = "Task"
const KEY_TASK_ID string = "TaskId"
const KEY_STATUS_TEXT string = "StatusText"
const KEY_RESULT string = "Result"
// 状态值
const STATUS_SUCCESS string = "SUCCESS"
const STATUS_RUNNING string = "RUNNING"
const STATUS_QUEUEING string = "QUEUEING"
type SentencesResult struct {
EndTime int64 `json:"EndTime"`
SilenceDuration int `json:"SilenceDuration"`
BeginTime int64 `json:"BeginTime"`
Text string `json:"Text"`
ChannelId int `json:"ChannelId"`
SpeechRate int `json:"SpeechRate"`
EmotionValue int `json:"EmotionValue"`
}
type WordResult struct {
BeginTime int64 `json:"BeginTime"`
EndTime int64 `json:"EndTime"`
ChannelId int `json:"ChannelId"`
Word string `json:"Word"`
}
type Result struct {
Sentences []*SentencesResult `json:"Sentences"`
Words []*WordResult `json:"Words"`
}
type Response struct {
TaskId string `json:"TaskId"`
RequestId string `json:"RequestId"`
StatusText string `json:"StatusText"`
BizDuration int64 `json:"BizDuration"`
SolveTime int64 `json:"SolveTime"`
StatusCode int32 `json:"StatusCode"`
Result *Result `json:"Result"`
}