Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove an data/models from nltk dowloader?

I installed some NLTK-packages in python3 NLTK (via nltk.download()), tried them and -not needing them- want to remove them now.

How can I remove for example the package large_grammars from my NLTK-installation? (I do not want to remove the complete NLTK-installation!)

like image 931
dia Avatar asked Mar 30 '17 09:03

dia


People also ask

How do I uninstall NLTK data?

Uninstall your current version of NLTK: Open up a terminal windows and type sudo pip uninstall nltk. Supply the administrative password, and then type "y" when prompted if you want to uninstall.

What is NLTK download (' Wordnet ')?

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/ .

Where is NLTK data stored?

It depends on where you set the destination folder when you download the data using nltk. download(). On Windows 10, the default destination is either C:\Users\narae\nltk_data or C:\Users\narae\AppData\Roaming\nltk_data, but you can specify a different directory before downloading.


1 Answers

By default NLTK packages/data are saved in the nltk_data directory.

First, you have to find where the directory might be:

>>> import nltk
>>> nltk.data.path
['/home/alvas/nltk_data', '/usr/share/nltk_data', '/usr/local/share/nltk_data', '/usr/lib/nltk_data', '/usr/local/lib/nltk_data']

Check the exact location of nltk_data:

>>> import os
>>> next(p for p in nltk.data.path if os.path.exists(p))
'/home/alvas/nltk_data'

On linux, simply go to the directory on the command line:

$ cd /home/alvas/nltk_data/
$ ls
corpora  grammars  tokenizers
$ cd grammars/
$ ls
large_grammars  large_grammars.zip
$ rm -rf large_grammars 
$ rm large_grammars.zip 
like image 176
alvas Avatar answered Sep 21 '22 12:09

alvas