2

I wanted to know what nltk.download() do. Also, if I add "wordnet" as an argument, then what happens. Is wordnet like some dataset or something, I would like more clarification on that.

Adarsh Wase
  • 1,727
  • 3
  • 12
  • 26
SarthakJain
  • 1,226
  • 6
  • 11
  • 1
    the simple answer to your question might be at the bottom of the documentation, http://www.nltk.org/install.html: `After installing the NLTK package, please do install the necessary datasets/models for specific functions to work. If you’re unsure of which datasets/models you’ll need, you can install the “popular” subset of NLTK data, on the command line type python -m nltk.downloader popular, or in the Python interpreter import nltk; nltk.download(‘popular’): For details, see http://www.nltk.org/data.html` – chickity china chinese chicken Aug 09 '21 at 21:53
  • For downloading the specific "wordnet" dictionary in your example, this question may already be answered here https://stackoverflow.com/questions/6661108/import-wordnet-in-nltk, which suggests the method `nltk.download()` , as the method name `download()` implies, instructs the nltk library to download the requested dictionary – chickity china chinese chicken Aug 09 '21 at 21:56

1 Answers1

1

The argument to nltk.download() is not a file or module, but a resource id that maps to a corpus, machine-learning model or other resource (or collection of resources) to be installed in your NLTK_DATA area. You can see a list of the available resources, and their IDs, at http://www.nltk.org/nltk_data/ .

You can use the special id "book" (as in nltk.download("book")) to download all resources mentioned in the nltk book; that's handy if you don't want to keep stopping your explorations to download missing resources.

Calling nltk.dowload() without an argument pops up an interactive browser window (if it can) that you can use to browse and select resources for download.

alexis
  • 48,685
  • 16
  • 101
  • 161