vocabulary should contain blank to make the decoder API easy to use.
Created by: chenjiasheng
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