Step by step for installing NLTK?
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?
PyPI Modulessection of https://github.com/Pythonista-Tools
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.