현재 분류 자 모델을 학습 중입니다. 어제 나는 당신이 또한 창조 된 분류 모델을 테스트한다면 더 정확할 것이라는 것을 알았다. 인터넷에서 모델 테스트 방법을 찾으려고했습니다 : testing openNLP model. 그러나 나는 그것을 작동시키지 못한다. 이유는 1.5 대신 OpenNLP 버전 1.83을 사용하고 있기 때문입니다. 누구나 OpenNLP의이 버전에서 내 모델을 적절하게 테스트하는 방법을 설명 할 수 있습니까?OpenNLP 분류 자 모델 테스트
미리 감사드립니다.
public static DoccatModel trainClassifier() throws IOException
{
// read the training data
final int iterations = 100;
InputStreamFactory dataIn = new MarkableFileInputStreamFactory(new File("src/main/resources/trainingSets/trainingssetTest.txt"));
ObjectStream<String> lineStream = new PlainTextByLineStream(dataIn, "UTF-8");
ObjectStream<DocumentSample> sampleStream = new DocumentSampleStream(lineStream);
// define the training parameters
TrainingParameters params = new TrainingParameters();
params.put(TrainingParameters.ITERATIONS_PARAM, iterations+"");
params.put(TrainingParameters.CUTOFF_PARAM, 0+"");
params.put(AbstractTrainer.ALGORITHM_PARAM, NaiveBayesTrainer.NAIVE_BAYES_VALUE);
// create a model from traning data
DoccatModel model = DocumentCategorizerME.train("NL", sampleStream, params, new DoccatFactory());
return model;
}