You can install NLTK over pip
(pip install nltk
).After it is installed, many components will not be present, and you will not be able to use some of NLTK's features.
From your Python shell, run the function ntlk.download()
to select which additional packages you want to install using UI. Alternatively, you can use python -m nltk.downloader [package_name]
.
nltk.download('all')
nltk.download('package-name')
import nltk
dwlr = nltk.downloader.Downloader()
# chunkers, corpora, grammars, help, misc,
# models, sentiment, stemmers, taggers, tokenizers
for pkg in dwlr.packages():
if pkg.subdir== 'taggers':
dwlr.download(pkg.id)
import nltk
dwlr = nltk.downloader.Downloader()
for pkg in dwlr.corpora():
dwlr._status_cache[pkg.id] = 'installed'
dwlr.download('all')