vocabulary should contain blank to make the decoder API easy to use.
https://github.com/PaddlePaddle/models/blob/8b5c739a847b03ae8e7daa10f5311ef8cd12290b/deep_speech_2/model_utils/decoder.py#L87
If vocabulary dosen't contain blank, we have:
vocabulary=['a', 'b', ..., 'z', ' ', '.']
len(vocabulary) = 28
len(prob_list) = 29
Then at line 135,
new_char = vocabulary[c]
here c ranges from 0 to len(prob_list), but vocabulary[28] causes index out of range.
To use this decoder, one have to make the vocabulary a dict indexed from 1 instead of a list indexed from 0, in spite of that the doc suggests vocabulary to be a list.
:param vocabulary: Vocabulary list.
:type vocabulary: list
This is really confusing.
@xinghai-sun @kuke
@chenjiasheng Thanks for your attention!
This wouldn't happen because we in fact have enforced blank_id equal to len(vocabulary). And blank_id shouldn't be passed as an argument to the decoder, we have fixed that in the C++ decoders and will fix the python version very soon.
@kuke OK, thanks for the reply.