The Stanford OpenNLP API provides another technique for classifying documents. In this recipe, we will demonstrate how to train a model and then use it to classify the text. We will create a training file and a test file for the purposes of classifying flowers and spices. We will also create a properties file to provide information so the classifier can work correctly. The ColumnDataClassifier class is used to represent the classifier.
Classifying documents using the Stanford API
Getting ready
To prepare, we need to do the following:
- Create a new Maven project
- Add the following dependency to the project's POM file:
<!-- https://mvnrepository.com/artifact/edu.stanford.nlp/stanford-corenlp -->
<dependency>
...