I use NLTK with wordnet in my project. I did the installation manually on my PC, with pip:
pip3 install nltk --user
in a terminal, then nltk.download()
in a python shell to download wordnet.
I want to automatize these with a setup.py
file, but I don't know a good way to install wordnet.
For the moment, I have this piece of code after the call to setup
("nltk"
is in the install_requires
list of the call to setup
):
import sys
if 'install' in sys.argv:
import nltk
nltk.download("wordnet")
Is there a better way to do this?
requirements.txt
file and usepip install -r requirements.txt
first. Then in mysetup.py
I have the manual download commandnltk.download("punkt")
which is used when I runpip install -e .
I believe this works because I'm building a Docker image/container, not trying to distribute a package. – Chianti