Merge pull request #1071 from MakerZorky/main

feat:增加DoubaoASR热词、替换词选项
This commit is contained in:
hrz
2025-05-01 18:08:43 +08:00
committed by GitHub
2 changed files with 12 additions and 9 deletions
+3
View File
@@ -232,6 +232,9 @@ ASR:
appid: 你的火山引擎语音合成服务appid
access_token: 你的火山引擎语音合成服务access_token
cluster: volcengine_input_common
# 热词、替换词使用流程:https://www.volcengine.com/docs/6561/155738
boosting_table_name: (选填)你的热词文件名称
correct_table_name: (选填)你的替换词文件名称
output_dir: tmp/
TencentASR:
# token申请地址:https://console.cloud.tencent.com/cam/capi
@@ -88,6 +88,8 @@ class ASRProvider(ASRProviderBase):
self.appid = config.get("appid")
self.cluster = config.get("cluster")
self.access_token = config.get("access_token")
self.boosting_table_name = config.get("boosting_table_name")
self.correct_table_name = config.get("correct_table_name")
self.output_dir = config.get("output_dir")
self.delete_audio_file = delete_audio_file
@@ -136,7 +138,13 @@ class ASRProvider(ASRProviderBase):
"user": {
"uid": str(uuid.uuid4()),
},
"request": {"reqid": reqid, "show_utterances": False, "sequence": 1},
"request": {
"reqid": reqid,
"show_utterances": False,
"sequence": 1,
"boosting_table_name": self.boosting_table_name,
"correct_table_name": self.correct_table_name,
},
"audio": {
"format": "raw",
"rate": 16000,
@@ -232,14 +240,6 @@ class ASRProvider(ASRProviderBase):
return pcm_data
@staticmethod
def read_wav_info(data: io.BytesIO = None) -> (int, int, int, int, int):
with io.BytesIO(data) as _f:
wave_fp = wave.open(_f, "rb")
nchannels, sampwidth, framerate, nframes = wave_fp.getparams()[:4]
wave_bytes = wave_fp.readframes(nframes)
return nchannels, sampwidth, framerate, nframes, len(wave_bytes)
@staticmethod
def slice_data(data: bytes, chunk_size: int) -> (list, bool):
"""