Skip to content

Commit 3df837b

Browse files
committed
update paraformer model input params
1 parent 669227c commit 3df837b

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

example/paraformer/voice_file/recordfile2text.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
)
1313

1414
func main() {
15-
model := paraformer.ParaformerV1
15+
model := paraformer.ParaformerV2
1616
token := os.Getenv("DASHSCOPE_API_KEY")
1717
if token == "" {
1818
panic("token is empty")
@@ -29,12 +29,14 @@ func main() {
2929
filePath := "file://" + voiceFile
3030

3131
req := &paraformer.AsyncTaskRequest{
32-
Model: paraformer.ParaformerV1,
32+
Model: paraformer.ParaformerV2,
3333
Input: paraformer.AsyncInput{
3434
// 官方示例中使用的远程文件.
3535
// FileURLs: []string{"https://dashscope.oss-cn-beijing.aliyuncs.com/samples/audio/paraformer/hello_world_female2.wav"},
3636
// 本地文件.
37-
FileURLs: []string{filePath},
37+
FileURLs: []string{filePath},
38+
DisfluencyRemovalEnabled: true,
39+
LanguageHints: []string{"zh", "en"},
3840
},
3941
Download: true, // 是否下载异步任务结果.
4042
}

paraformer/dtypes.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@ type AsyncTaskRequest struct {
7676
}
7777

7878
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生效
8084
}
8185

8286
type AsyncTaskResponse struct {

0 commit comments

Comments
 (0)