Skip to content

Commit

Permalink
with @qiantong fix lexicon decoder for --surround usage with CTC crit…
Browse files Browse the repository at this point in the history
…erion
  • Loading branch information
Tatiana Likhomanenko committed Oct 16, 2020
1 parent 96f5f9d commit b1d1f89
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Decode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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> trie = nullptr;
if (FLAGS_decodertype == "wrd" || FLAGS_uselexicon) {
Expand Down
5 changes: 3 additions & 2 deletions src/libraries/decoder/LexiconDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit b1d1f89

Please sign in to comment.