try {
paramsIn = new FileInputStream(new File(inFileValue));
params = new opennlp.tools.util.TrainingParameters(paramsIn);
} catch (IOException e) {
throw new ResourceInitializationException(e);
}
finally {
try {
if (paramsIn != null)
paramsIn.close();
} catch (IOException e) {
}
}
if (!TrainUtil.isValid(params.getSettings())) {
throw new ResourceInitializationException(new Exception("Training parameters file is invalid!"));
}
if (!isSequenceTrainingAllowed && TrainUtil.isSequenceTraining(params.getSettings())) {
throw new ResourceInitializationException(new Exception("Sequence training is not supported!"));
}
}
else {
params = TrainingParameters.defaultParams();
}