April 2019
Beginner to intermediate
386 pages
11h 20m
English
The categories array holds the names of the categories found in the training file. An instance of the DynamicLMClassifier class was created using these categories and an nGramSize size of 6. This value specifies the number of contiguous elements of text in one sequence that will be used to classify the text. We specified the 4news-train directory to be used for training:
int nGramSize = 6;DynamicLMClassifier<NGramProcessLM> dynamicLMClassifier = DynamicLMClassifier.createNGramProcess(categories, nGramSize);final String rootDirectory = "../demos";final File trainingDirectory = new File(rootDirectory + "/data/fourNewsGroups/4news-train");
There are four subdirectories, 4news-train, which match the categories names. Within ...
Read now
Unlock full access