From a4de8b2a0a69ba42c58d6bacb9c9108539a1e280 Mon Sep 17 00:00:00 2001
From: 北念 <lzr265946@alibaba-inc.com>
Date: 星期二, 10 十月 2023 15:49:04 +0800
Subject: [PATCH] update asr postprocess_utils
---
funasr/bin/asr_inference_launch.py | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/funasr/bin/asr_inference_launch.py b/funasr/bin/asr_inference_launch.py
index 50b9886..3695980 100644
--- a/funasr/bin/asr_inference_launch.py
+++ b/funasr/bin/asr_inference_launch.py
@@ -488,6 +488,7 @@
):
ncpu = kwargs.get("ncpu", 1)
torch.set_num_threads(ncpu)
+ language = kwargs.get("model_lang", None)
if word_lm_train_config is not None:
raise NotImplementedError("Word LM is not implemented")
@@ -694,10 +695,13 @@
text, token, token_int = result[0], result[1], result[2]
time_stamp = result[4] if len(result[4]) > 0 else None
- if use_timestamp and time_stamp is not None and len(time_stamp):
- postprocessed_result = postprocess_utils.sentence_postprocess(token, time_stamp)
+ if language == "en-bpe":
+ postprocessed_result = postprocess_utils.sentence_postprocess_sentencepiece(token)
else:
- postprocessed_result = postprocess_utils.sentence_postprocess(token)
+ if use_timestamp and time_stamp is not None and len(time_stamp):
+ postprocessed_result = postprocess_utils.sentence_postprocess(token, time_stamp)
+ else:
+ postprocessed_result = postprocess_utils.sentence_postprocess(token)
text_postprocessed = ""
time_stamp_postprocessed = ""
text_postprocessed_punc = postprocessed_result
--
Gitblit v1.9.1