FunASR icon indicating copy to clipboard operation
FunASR copied to clipboard

在SenseVoice使用时候怎么设置需要标点,但不需要逆文本正则化

Open zuiyuewentian opened this issue 8 months ago • 0 comments
trafficstars

❓ 在SenseVoice使用时候怎么设置需要标点,但不需要逆文本正则化

Code

from funasr import AutoModel
from funasr.utils.postprocess_utils import rich_transcription_postprocess

model_dir = "iic/SenseVoiceSmall"

model = AutoModel(
    model=model_dir,
    vad_model="fsmn-vad",
    vad_kwargs={"max_single_segment_time": 30000},
    device="cuda:0",
)

res = model.generate(
    input=f"{model.model_path}/example/en.mp3",
    cache={},
    language="auto",  # "zn", "en", "yue", "ja", "ko", "nospeech"
    use_itn=True,
    batch_size_s=60,
    merge_vad=True,  #
    merge_length_s=15,
)
text = rich_transcription_postprocess(res[0]["text"])
print(text)

说话时候,如果我说年龄,说两遍,比如,四十四四十四 我能看出来是四十是岁 如果逆文本后,变成了4444,会导致误解成一个数字

zuiyuewentian avatar Mar 10 '25 09:03 zuiyuewentian