SentenceDetectorEvaluator extends Evaluator<SentenceSample> { public FMeasure getFMeasure() { return fmeasure; } SentenceDetectorEvaluator(SentenceDetector sentenceDetector,
      SentenceDetectorEvaluationMonitor... listeners); FMeasure getFMeasure();  }
@Test public void testPositive() throws InvalidFormatException { OutputStream stream = new ByteArrayOutputStream(); SentenceDetectorEvaluationMonitor listener = new SentenceEvaluationErrorListener(stream); SentenceDetectorEvaluator eval = new SentenceDetectorEvaluator(new DummySD( SentenceSampleTest.createGoldSample()), listener); eval.evaluateSample(SentenceSampleTest.createGoldSample()); assertEquals(1.0, eval.getFMeasure().getFMeasure()); assertEquals(0, stream.toString().length()); }
@Test public void testNegative() throws InvalidFormatException { OutputStream stream = new ByteArrayOutputStream(); SentenceDetectorEvaluationMonitor listener = new SentenceEvaluationErrorListener(stream); SentenceDetectorEvaluator eval = new SentenceDetectorEvaluator(new DummySD( SentenceSampleTest.createGoldSample()), listener); eval.evaluateSample(SentenceSampleTest.createPredSample()); assertEquals(-1.0, eval.getFMeasure().getFMeasure(), .1d); assertNotSame(0, stream.toString().length()); }