Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

how to get vocab #69

Open
wqfengnlpr opened this issue Apr 30, 2020 · 2 comments
Open

how to get vocab #69

wqfengnlpr opened this issue Apr 30, 2020 · 2 comments

Comments

@wqfengnlpr
Copy link

Hi,
I am very confused how the vocab function works. It seems the vocab only reads a model file, which only contains the token id without the mapping (the id and subword), so how can we get the subword from these ID?

I use the following order to get the vocab, and I am very surprised that the vocab file shows all subwords.
yttm vocab --model yttm.model >yttm.vocab

best wishes

@dantougit
Copy link

bpe = yttm.BPE(model='./yttm.model')
bpe.vocab()

@wqfengnlpr
Copy link
Author

bpe = yttm.BPE(model='./yttm.model')
bpe.vocab()

I just wonder why this model can produce the vocab. Because the model file only contains the digital IDs, there is not any alphabet. So how does it get the mapping between the Id and alphabet in the function of Vocab().

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

No branches or pull requests

2 participants