Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vocabulary should contain blank to make the decoder API easy to use. #254

Closed
chenjiasheng opened this issue Sep 15, 2017 · 2 comments
Closed

Comments

@chenjiasheng
Copy link

chenjiasheng commented Sep 15, 2017

raise ValueError("The shape of prob_seq does not match with the "

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

@kuke
Copy link
Collaborator

kuke commented Sep 15, 2017

@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.

@chenjiasheng
Copy link
Author

@kuke OK, thanks for the reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants