feat:增加DoubaoASR热词、替换词选项

This commit is contained in:
MakerZorky
2025-04-30 13:34:00 +08:00
parent bf748773c8
commit e8b1156bfd
2 changed files with 11 additions and 9 deletions
+2
View File
@@ -232,6 +232,8 @@ ASR:
appid: 你的火山引擎语音合成服务appid
access_token: 你的火山引擎语音合成服务access_token
cluster: volcengine_input_common
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):
"""