NLTK Trainer exists to make training and evaluating NLTK objects as easy as possible.
The scripts with default arguments have been tested for compatibility with Python3.7 and NLTK 3.4.5. If something does not work for you, please open an issue. Include the script with arguments and failure or exception output. To use the sklearn classifiers, you must also install scikit-learn.
If you want to use any of the corpora that come with NLTK, you should install the NLTK data.
Documentation can be found at nltk-trainer.readthedocs.org (you can also find these documents in the docs directory. Many of the scripts are covered in Python 3 Text Processing with NLTK 3 Cookbook, and every script provides a --help
option that describes all available parameters.
The trained models are pickle files that by default are put into your nltk_data
directory. You can load them using nltk.data.load
, for example:
import nltk.data classifier = nltk.data.load('classifiers/movie_reviews_NaiveBayes.pickle')
You now have a NLTK classifier object you can work with.