public void test() throws Exception { /* * Read the test dataset. Each of the test instance is encapsulated in the * object which provides DataSequence interface. */ /* * Once you have loaded the test dataset, you need to allocate objects * for the model to be learned. allocmodel() method does that allocation. * Also, you need to read learned parameters from the disk stored after * training. If the model is already available in the memory, then you do * not need to reallocate the model i.e. you can skip the next step in that * case. */ allocModel(); featureGen.read(baseDir+"/learntModels/"+outDir+"/features"); crfModel.read(baseDir+"/learntModels/"+outDir+"/crf"); /* * Iterate over test data set and apply the crf model to each test instance. */ while(...) { /* * Now apply CRF model to each test instance. */ crfModel.apply(testRecord); /* * The labeled instance have value of the states as labels. * These state values are not labels as supplied during training. * To map this state to one of the labels you need to call following * method on the labled testRecord. */ featureGen.mapStatesToLabels(testRecord); } }