List of usage examples for opennlp.tools.cmdline TerminateToolException TerminateToolException
public TerminateToolException(int code, String message, Throwable t)
From source file:es.ehu.si.ixa.pipe.nerc.train.InputOutputUtils.java
private static TrainingParameters loadTrainingParameters(String paramFile, boolean supportSequenceTraining) { TrainingParameters params = null;/*from www. j ava 2 s . c o m*/ if (paramFile != null) { checkInputFile("Training Parameter", new File(paramFile)); InputStream paramsIn = null; try { paramsIn = new FileInputStream(new File(paramFile)); params = new opennlp.tools.util.TrainingParameters(paramsIn); } catch (IOException e) { throw new TerminateToolException(-1, "Error during parameters loading: " + e.getMessage(), e); } finally { try { if (paramsIn != null) paramsIn.close(); } catch (IOException e) { // sorry that this can fail } } if (!TrainUtil.isValid(params.getSettings())) { throw new TerminateToolException(1, "Training parameters file '" + paramFile + "' is invalid!"); } if (!supportSequenceTraining && TrainUtil.isSequenceTraining(params.getSettings())) { throw new TerminateToolException(1, "Sequence training is not supported!"); } } return params; }