Merge pull request #2607 from lissyx/fix-silences

Don't OOV_SCORE on empty prefix
This commit is contained in:
lissyx 2020-01-02 15:07:47 +01:00 committed by GitHub
commit 48401e96fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -169,9 +169,7 @@ DecoderState::decode() const
if (ext_scorer_ != nullptr) {
for (size_t i = 0; i < beam_size_ && i < prefixes_copy.size(); ++i) {
auto prefix = prefixes_copy[i];
if (prefix->is_empty()) {
scores[prefix] = OOV_SCORE;
} else if (!ext_scorer_->is_scoring_boundary(prefix->parent, prefix->character)) {
if (!ext_scorer_->is_scoring_boundary(prefix->parent, prefix->character)) {
float score = 0.0;
std::vector<std::string> ngram = ext_scorer_->make_ngram(prefix);
bool bos = ngram.size() < ext_scorer_->get_max_order();