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

Add access to vocabulary in python bindings #30

Open
cypreess opened this issue Mar 25, 2015 · 4 comments
Open

Add access to vocabulary in python bindings #30

cypreess opened this issue Mar 25, 2015 · 4 comments

Comments

@cypreess
Copy link

It would be nice to have access to kenlm.LanguageModel.vocab or even (maybe more pytonic way) to support iterable protocol on kenlm.LanguageModel.

@kpu
Copy link
Owner

kpu commented Mar 26, 2015

Would a callback from LoadVirtual be sufficient?

@kpu
Copy link
Owner

kpu commented Mar 26, 2015

The C++ side doesn't even remember the vocabulary strings by default because users either don't need it or have their own data structure populated by the EnumerateVocab callback API.

@cypreess
Copy link
Author

I must say I did not read very deeply into the implementation. Just wondering if it's easy to implement access vocabulary somehow.

@manishbansal-fk
Copy link

@kpu Is there any way we can access LanguageModel vocab from python wrapper. I am loading model as kenlm.Model(model.klm) in python. "model.klm" is built from command line.

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

3 participants