diff --git a/Decode.cpp b/Decode.cpp index e68605a7..cb41e407 100644 --- a/Decode.cpp +++ b/Decode.cpp @@ -251,7 +251,7 @@ int main(int argc, char** argv) { FLAGS_criterion == kCtcCriterion ? tokenDict.getIndex(kBlankToken) : -1; int silIdx = -1; if (FLAGS_wordseparator != "") { - tokenDict.getIndex(FLAGS_wordseparator); + silIdx = tokenDict.getIndex(FLAGS_wordseparator); } std::shared_ptr trie = nullptr; if (FLAGS_decodertype == "wrd" || FLAGS_uselexicon) { diff --git a/src/libraries/decoder/LexiconDecoder.cpp b/src/libraries/decoder/LexiconDecoder.cpp index 66c4cbf9..00806724 100644 --- a/src/libraries/decoder/LexiconDecoder.cpp +++ b/src/libraries/decoder/LexiconDecoder.cpp @@ -154,8 +154,9 @@ void LexiconDecoder::decodeStep(const float* emissions, int T, int N) { } /* (2) Try same lexicon node */ - if (opt_.criterionType != CriterionType::CTC || !prevHyp.prevBlank) { - int n = prevIdx; + if (opt_.criterionType != CriterionType::CTC || !prevHyp.prevBlank || + prevLex == lexicon_->getRoot()) { + int n = prevLex == lexicon_->getRoot() ? sil_ : prevIdx; double amScore = emissions[t * N + n]; if (nDecodedFrames_ + t > 0 && opt_.criterionType == CriterionType::ASG) {