Step by step for installing NLTK?
fiannao last edited by
I'm fairly new to coding and Python, but have been using NLTK. I've been trying to download NLTK onto Pythonista, but have not had much success.
Can someone give me a step by step, if possible including scripts you used, for downloading and using NLTK?
ccc last edited by
PyPI Modulessection of https://github.com/Pythonista-Tools
ltddev last edited by
There are two parts to NLTK, Natural Language Toolkit. There is the NLTK libraries but there is also the various data packages (corpora) this library uses. The above mentioned script will download and install the library, but not the corpora. To download and install corpora, you import nltk and then do a:
either from the command prompt or in a script. Outside of Pythonista where
download()finds a graphical interface (TkInter) it launches a GUI-based installer. If it does not find Tkinter, as is the situation in Pythonista, it instead launches a command-line version that accepts one letter commands to list, select and download any and all available corpora.
Once you have the main libraries which are pure Python, have downloaded the corpora/data, you will need to do one further thing to actually use NLTK and corpora from Pythonista. You need to set an environment variable that points to the
NLTK_DATAor the root directory of the installed corpora, IF you installed them to a location not automatically searched. NLTK will expect this data root to be off the Pythonista app itself, not to Documents directory which is a subdir in it. You can either use an external tool like iFunbox or an internal one like iFile available from Cydia for jailbroken devices, to move the nltk data directory to the Pythonista app. Alternatively, in a script that wants to actually use the corpora you will need to set the environment variable
NLTK__DATAto the location of the corpora.
cheseremtitus last edited by
I've tried to get up an running with NLTK through installer script from pypi modules and it throws the following errors on attempted install under python 2.7.
- ProtocolError: <ProtocolError for pypi.python.org/pypi: 403 [[[!!! BREAKING CHANGE !!!]]] Support for clients that do not support Server Name Indication is temporarily disabled and will be permanently deprecated soon. See https://status.python.org/incidents/hzmjhqsdjqgb and https://github.com/pypa/pypi-support/issues/978 [[[!!! END BREAKING CHANGE !!!]]]>
I tried using pip install from stash but it failed while installing the regex module as it contains C code that required compiling.
Any work around would be greatly appreciated.