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

10.12 机器翻译一节初始化Vocab #113

Open
alqbib opened this issue Mar 28, 2020 · 0 comments
Open

10.12 机器翻译一节初始化Vocab #113

alqbib opened this issue Mar 28, 2020 · 0 comments

Comments

@alqbib
Copy link

alqbib commented Mar 28, 2020

10.12 机器翻译一节初始化Vocab中加入'<unk>',即:
vocab = torchtext.vocab.Vocab(collections.Counter(all_tokens), specials=['<unk>', PAD, BOS, EOS])
这样结果的词序索引与原书相同,最后预测不在词典里的词时也不会报错.

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

1 participant