How to import spaCy’s types avoiding the loading delay? #8986
danmysak
started this conversation in
Help: Best practices
Replies: 1 comment 2 replies
-
With the caveat that I'm not an expert on this, I think you can use an |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
Let’s say I’m using spaCy conditionally. Let’s also say I want to decrease my script’s loading time by importing the library only when it is actually required. All is good so far: I can simply put
import spacy
into a function that gets called when the library is needed. But if the function returns a result of type, say,spacy.language.Doc
, how do I annotate it without loading the module first? Bothimport spacy
andimport spacy.language
take a couple of seconds to execute.Thanks to all the maintainers for the great tool, by the way!
Beta Was this translation helpful? Give feedback.
All reactions