SentenceSplitter { public List<Unit> predict(List<String> lines, String postprocessingFilter) { if (!trained || model == null) { throw new IllegalStateException("No model available. Train or load trained model first."); } Instance inst = model.getInputPipe().instanceFrom(new Instance(lines, null, null, null)); return predict(inst, postprocessingFilter); } SentenceSplitter(); Instance makePredictionData(ArrayList<String> lines, Pipe myPipe); Instance makePredictionData(File predictFile, Pipe myPipe); InstanceList makePredictionData(File[] predictFiles, Pipe myPipe); InstanceList makeTrainingData(File[] trainFiles, boolean useTokenOffset, boolean splitUnitsAfterPunctuation); void train(InstanceList instList, Pipe dataPipe); List<Unit> predict(List<String> lines, String postprocessingFilter); List<Unit> predict(Instance inst, String filterName); ArrayList<String> getLabelsFromLabelSequence(LabelSequence ls); void writeModel(String filename); void readModel(File file); void readModel(InputStream is); ArrayList<String> readFile(File myFile); CRF getModel();  }
@Test public void testPredict() throws Exception { File[] trainFiles = getTrainFiles(); SentenceSplitter sentenceSplitter = new SentenceSplitter(); sentenceSplitter.readModel(new File(FILENAME_MODEL)); String text = readTextFromFile(FILENAME_ABSTRACT); ArrayList<String> lines = new ArrayList<String>(); lines.add(text); Pipe myPipe = sentenceSplitter.model.getInputPipe(); Instance instance = sentenceSplitter.makePredictionData(lines, myPipe); List<Unit> unitList = sentenceSplitter.predict(instance, "biomed"); assertNotNull(unitList); for (Unit unit : unitList) { LOGGER.trace("unit=" + unit); } }