viernes, 4 de enero de 2019

installing NLTK in Debian

By default, Debian brings installed Python 2, required it for diverse tasks, as well as Perl, C/C++, PHP, etc.

For professional environment, is better to use virtualenv.

So, I'm going to use the last installed Python version.

$ python --version
Python 2.7.13

$ python3 --version
Python 3.5.3

Setting NLTK in Python 3:

$ sudo apt install python3-pip
$ sudo pip3 install -U numpy
$ sudo pip3 install -U nltk

"Successfully installed nltk-3.4 singledispatch-3.4.0.3 six-1.12.0"


$ python3
>>import nltk
>> nltk.download( )
>> d book
>> d spanish_grammars
>> d twitter_samples

>>> from nltk.corpus import brown
>>> brown.words()
['The', 'Fulton', 'County', 'Grand', 'Jury', 'said', ...]


Sources: 

(book) Steven Bird, Ewan Klein, Edward Loper, Natural Language Processing in Python. Ver. 0.9, October 12, 2007. University of Pennsylvania.  
NLTK with Python 3 for Natural Language Processing, by sentdex. Published on May 1, 2015.