From 9d15ce683c35a881751c7ed3e9232892fe597e85 Mon Sep 17 00:00:00 2001 From: kxhuang Date: Fri, 4 Aug 2023 09:54:38 +0800 Subject: [PATCH] Modify logic --- runtime/core/decoder/context_graph.cc | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/runtime/core/decoder/context_graph.cc b/runtime/core/decoder/context_graph.cc index e2d5e6bdb..a44aab628 100644 --- a/runtime/core/decoder/context_graph.cc +++ b/runtime/core/decoder/context_graph.cc @@ -152,7 +152,7 @@ bool ContextGraph::SplitUTF8StringToWords( continue; } // Add '▁' at the beginning of English word. - if (IsAlpha(word) && beginning == true) { + if (IsAlpha(word) && beginning) { word = kSpaceSymbol + word; } @@ -163,14 +163,13 @@ bool ContextGraph::SplitUTF8StringToWords( continue; } - // Matching using '▁' separately for English - if (end == start + 1 && word[0] == kSpaceSymbol[0]) { - words->emplace_back(string(kSpaceSymbol)); - beginning = false; - break; - } - if (end == start + 1) { + // Matching using '▁' separately for English + if (word[0] == kSpaceSymbol[0]) { + words->emplace_back(string(kSpaceSymbol)); + beginning = false; + break; + } ++start; no_oov = false; LOG(WARNING) << word << " is oov.";