Skip to content

Commit

Permalink
Modify logic
Browse files Browse the repository at this point in the history
  • Loading branch information
kaixunhuang0 committed Aug 4, 2023
1 parent 14f0865 commit 9d15ce6
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions runtime/core/decoder/context_graph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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.";
Expand Down

0 comments on commit 9d15ce6

Please sign in to comment.