Text classification in Flair
Flair offers a simple interface for using pre-trained models as well as training custom text classifiers. While Flair's secret sauce – the forward and backward Flair embeddings – aren't the best tool for text classification tasks, Flair can leverage other third-party methods to yield excellent performance in text classification.
Let's first learn how to train and use Flair's pre-trained models.
Using pre-trained Flair text classification models
The set of pre-trained text classification models available in Flair is fairly small, and chances are, the model you're looking for isn't there. Even so, the following syntax will be valuable, as the API for loading and using the Flair pre-trained models is the same as the API for loading and using custom-trained models. We will train those in the next section.
Flair currently offers the following stable pre-trained models:
sentiment
– a sentiment...