File tree Expand file tree Collapse file tree 3 files changed +15
-4
lines changed
example/paraformer/voice_file Expand file tree Collapse file tree 3 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import (
12
12
)
13
13
14
14
func main () {
15
- model := paraformer .ParaformerV1
15
+ model := paraformer .ParaformerV2
16
16
token := os .Getenv ("DASHSCOPE_API_KEY" )
17
17
if token == "" {
18
18
panic ("token is empty" )
@@ -29,12 +29,14 @@ func main() {
29
29
filePath := "file://" + voiceFile
30
30
31
31
req := & paraformer.AsyncTaskRequest {
32
- Model : paraformer .ParaformerV1 ,
32
+ Model : paraformer .ParaformerV2 ,
33
33
Input : paraformer.AsyncInput {
34
34
// 官方示例中使用的远程文件.
35
35
// FileURLs: []string{"https://dashscope.oss-cn-beijing.aliyuncs.com/samples/audio/paraformer/hello_world_female2.wav"},
36
36
// 本地文件.
37
- FileURLs : []string {filePath },
37
+ FileURLs : []string {filePath },
38
+ DisfluencyRemovalEnabled : true ,
39
+ LanguageHints : []string {"zh" , "en" },
38
40
},
39
41
Download : true , // 是否下载异步任务结果.
40
42
}
Original file line number Diff line number Diff line change @@ -76,7 +76,11 @@ type AsyncTaskRequest struct {
76
76
}
77
77
78
78
type AsyncInput struct {
79
- FileURLs []string `json:"file_urls"`
79
+ FileURLs []string `json:"file_urls"`
80
+ VocabularyID string `json:"vocabulary_id,omitempty"` // 热词表 ID.
81
+ ChannelID []int `json:"channel_id,omitempty"` // 音轨索引.
82
+ DisfluencyRemovalEnabled bool `json:"disfluency_removal_enabled,omitempty"` // 过滤语气词.
83
+ LanguageHints []string `json:"language_hints,omitempty"` // 识别语音中语言的代码列表. 仅对paraformer-v2生效
80
84
}
81
85
82
86
type AsyncTaskResponse struct {
Original file line number Diff line number Diff line change 9
9
ParaformerV1 ModelParaformer = "paraformer-v1"
10
10
Paraformer8KV1 ModelParaformer = "paraformer-8k-v1"
11
11
ParaformerMtlV1 ModelParaformer = "paraformer-mtl-v1"
12
+ ParaformerV2 ModelParaformer = "paraformer-v2"
13
+ Paraformer8KV2 ModelParaformer = "paraformer-8k-v2"
14
+
12
15
// real time voice.
13
16
ParaformerRealTimeV1 ModelParaformer = "paraformer-realtime-v1"
14
17
ParaformerRealTime8KV1 ModelParaformer = "paraformer-realtime-8k-v1"
18
+ ParaformerRealTimeV2 ModelParaformer = "paraformer-realtime-v2"
19
+ ParaformerRealTime8KV2 ModelParaformer = "paraformer-realtime-8k-v2"
15
20
)
16
21
17
22
const (
You can’t perform that action at this time.
0 commit comments