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

NLTK dependencies are downloaded during the import phase #12

Open
tmiskow opened this issue Apr 6, 2020 · 0 comments
Open

NLTK dependencies are downloaded during the import phase #12

tmiskow opened this issue Apr 6, 2020 · 0 comments

Comments

@tmiskow
Copy link

tmiskow commented Apr 6, 2020

Unfortunately, NLTK dependencies are downloaded during the import phase, therefore, making it very difficult to configure nltk data paths and download directories beforehand.

I think simply moving the following code to from the top level to the G2p object initialization should solve the issue.

try:
    nltk.data.find('taggers/averaged_perceptron_tagger.zip')
except LookupError:
    nltk.download('averaged_perceptron_tagger')
try:
    nltk.data.find('corpora/cmudict.zip')
except LookupError:
    nltk.download('cmudict')

Maybe we could also provide nltk_data_diretcory as an optional argument and pass it to nltk.download invocations?

@tmiskow tmiskow changed the title Nltk dependencies are downloaded during the import phase NLTK dependencies are downloaded during the import phase Apr 6, 2020
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