[fix] handle case of T = 0 in Viterbi decoding

This commit is contained in:
Al
2017-03-12 22:55:48 -04:00
parent 35ccb3ee62
commit 6cf113b1df
2 changed files with 8 additions and 2 deletions

View File

@@ -564,6 +564,9 @@ double crf_context_viterbi(crf_context_t *self, uint32_t *labels) {
const double *trans = NULL;
const size_t T = self->num_items;
if (T == 0) {
return max_score;
}
const size_t L = self->num_labels;
// This function assumes state and trans scores to be in the logarithm domain.