From c9f8c4fde0bd9c89039c676d867ec0a94a9acc68 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Fri, 10 Nov 2023 17:09:48 +0800 Subject: [PATCH] Fix punctuations in tts (#417) --- sherpa-onnx/csrc/lexicon.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sherpa-onnx/csrc/lexicon.cc b/sherpa-onnx/csrc/lexicon.cc index 9cdfd8f47..5d9ad8ff1 100644 --- a/sherpa-onnx/csrc/lexicon.cc +++ b/sherpa-onnx/csrc/lexicon.cc @@ -214,7 +214,9 @@ std::vector Lexicon::ConvertTextToTokenIdsChinese( for (const auto &w : words) { if (punctuations_.count(w)) { - if (sil != -1) { + if (token2id_.count(w)) { + ans.push_back(token2id_.at(w)); + } else if (sil != -1) { ans.push_back(sil); } continue;