Skip to content
Discussion options

You must be logged in to vote

This is because doc.lang_ is a property proxying to doc.vocab.lang and of course doc.vocab is not loaded.

That's correct, yes. In your code, you'll still have a Vocab btw – the Language class initializes this automatically. It's just that your Vocab is blank and doesn't have a language assigned.

The meta["lang"] setting exists so that you can create an instance of the same Language subclass – e.g. via util.get_lang_class(meta["lang"]). This is also how spaCy does it under the hood when you load a model.

I'm assuming you don't want to load the vocab because or the word vectors? The following shouldn't be slower than what you currently have:

lang_cls = spacy.util.get_lang_class(lang)
lang…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by ines
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat / serialize Feature: Serialization, saving and loading
3 participants