@Override protected void postProcessAnnotations(AnnotationFS[] sentences) { if (probabilityFeature != null) { double[] sentenceProbabilities = sentenceDetector.getSentenceProbabilities(); for (int i = 0; i < sentences.length; i++) { sentences[i].setDoubleValue(probabilityFeature, sentenceProbabilities[i]); } } }
@Override protected void postProcessAnnotations(AnnotationFS[] sentences) { if (probabilityFeature != null) { double[] sentenceProbabilities = sentenceDetector.getSentenceProbabilities(); for (int i = 0; i < sentences.length; i++) { sentences[i].setDoubleValue(probabilityFeature, sentenceProbabilities[i]); } } }
Assert.assertEquals(sents[0],"This is a test."); Assert.assertEquals(sents[1],"There are many tests, this is the second."); double[] probs = sentDetect.getSentenceProbabilities(); Assert.assertEquals(probs.length,2); sents = sentDetect.sentDetect(sampleSentences2); Assert.assertEquals(sents.length,2); probs = sentDetect.getSentenceProbabilities(); Assert.assertEquals(probs.length,2); Assert.assertEquals(sents[0],"This is a test."); sents = sentDetect.sentDetect(sampleSentences3); Assert.assertEquals(sents.length,2); probs = sentDetect.getSentenceProbabilities(); Assert.assertEquals(probs.length,2); Assert.assertEquals(sents[0],"This is a \"test\"."); sents = sentDetect.sentDetect(sampleSentences4); Assert.assertEquals(sents.length,3); probs = sentDetect.getSentenceProbabilities(); Assert.assertEquals(probs.length,3); Assert.assertEquals(sents[0],"This is a \"test\"."); Assert.assertEquals(1, sentDetect.getSentenceProbabilities().length); Assert.assertEquals(sents[0],"This is a one sentence test space at the end."); sents = sentDetect.sentDetect(sampleSentences11); Assert.assertEquals(sents[0],"This is test sentence without a dot at the end and spaces"); probs = sentDetect.getSentenceProbabilities();