Natural Language Toolkit

...software, data sets and tutorials for natural language processing...

Download

 

From NLTK

(Redirected from Installation)
Jump to: navigation, search

Contents

CD-ROM

An ISO image is available, containing all the packages listed on this page. You can burn this image to CD and share it with others.

Windows

Required: Please download the following packages, and install them using an administrator account:

Data: Unpack the data using a utility such as Winzip, create a folder C:\nltk and move the data folder into this location. (If the data folder that you created is not in this default location then you will need to set the NLTK_DATA environment variable: right click on "My Computer", select Properties > Advanced > Environment Variables > User Variables > New..., then type NLTK_DATA into the Variable field, and type the path to the NLTK data folder that you created into the Value field.)

Optional: Some users may need the following:

Macintosh

Required: NLTK requires Python 2.4 or later. Open Finder > Applications and check for a version of MacPython. If necessary, install Python, then install NLTK:

Optional Some users may need the following:

Linux/Unix

Required: NLTK requires Python 2.4 or later (check with python -V). If you need to install Python, you can do this using your favorite package manager, or find a suitable RPM, or download and build Python from source: http://www.python.org/ftp/python/2.5.2/Python-2.5.2.tgz

Optional Some users may need the following:

Install these by unpacking the source distribution and running sudo python setup.py install

Now proceed with NLTK Source Installation (below).

NLTK Source Installation

These instructions are for Mac, Linux and Unix platforms.

Check your Python installation is adequate: open a terminal and type python -V to see what version you get; once you get the python prompt type import numpy to check you can load the numerical library (set your PATH and PYTHONPATH environment variables if necessary).

1. Download the NLTK source distribution:

Unpack the archive (e.g. with gunzip or Stuffit Expander); this will create a new folder nltk-0.9.3. Open the terminal and cd into this new folder, and type

sudo python setup.py install

(If you are using Mac OS, when you are prompted for your password, use the password that you use to login to your machine.) Once you have done this installation step you can remove the nltk-0.9.3 folder.

2. Next, download the NLTK Data distribution: http://prdownloads.sourceforge.net/nltk/nltk-data-0.9.3.zip

Unpack this archive to extract a folder called data, and move this into /usr/share/nltk or ~/nltk. Note that if this is the first time you have installed the NLTK data, the directory will need to be created:

sudo mkdir /usr/share/nltk

Assuming you are in the directory where you unpacked the data zip archive, give the command

sudo mv data /usr/share/nltk/

Next, in order to make sure that the data files are readable, type

sudo chmod -R g+r /usr/share/nltk/data

If you installed the data as /usr/share/nltk/data, just test your installation as described in the next step. If you installed it somewhere else, however, you will need to set an environment variable to refer to this location, using a statement of the form

export NLTK_DATA=/path/to/your/nltk/data
If you know how to edit your .bash_profile or .bashrc file, just add a version of the above line, where /path/to/your/nltk is replaced with the path to your data directory. Alternatively, type the following commands:
echo export NLTK_DATA=/path/to/your/nltk/data >> ~/.bashrc
source ~/.bashrc

3. Now you should be done. In order to check that the installation is working OK, try the following in the python interactive interpreter:

>>> import nltk
>>> nltk.corpus.brown.words()

You should see several lines of text.

Debian Installation

NLTK is available as a Debian package from the following URL (not always most recent version):

Installation to Non-Standard Location

If you don't want to install NLTK in a central location, download and unpack the zip distributions:

Move NLTK to the desired location, then add this location to your PYTHONPATH. Similarly, move the NLTK data to the desired location, and set this location as the value of NLTK_DATA

Downloading the Documentation

You can download all of the documentation (book, API docs, presentation slides), as a single zip file, from:

Personal tools