Skip to content

japerk/nltk-trainer

Repository files navigation

NLTK Trainer

NLTK Trainer exists to make training and evaluating NLTK objects as easy as possible.

Requirements

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

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.

Using Trained Models

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.