This is an automated email from the ASF dual-hosted git repository. mawiesne pushed a commit to branch Sanitize-deprecation-warnings in repository https://gitbox.apache.org/repos/asf/opennlp-sandbox.git
commit 837382b231945efb99921d479f5d0bd69fe93d03 Author: Martin Wiesner <[email protected]> AuthorDate: Mon Jul 14 20:06:24 2025 +0200 Sanitizes deprecation of SentenceDetectorME#getSentenceProbabilities() method --- .../opennlp/caseditor/sentdetect/SentenceDetectorJob.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/sentdetect/SentenceDetectorJob.java b/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/sentdetect/SentenceDetectorJob.java index b52de98..aa085b5 100644 --- a/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/sentdetect/SentenceDetectorJob.java +++ b/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/sentdetect/SentenceDetectorJob.java @@ -94,13 +94,10 @@ public class SentenceDetectorJob extends Job { detectedSentences = new ArrayList<>(); for (Span para : paragraphs) { - List<Span> textBlocks = new ArrayList<>(); int textBlockBeginIndex = 0; - for (Span exclusionSpan : exclusionSpans) { - Span textBlockSpan = new Span(textBlockBeginIndex, exclusionSpan.getStart()); // TODO: Filter out whitespace sentences ... @@ -117,18 +114,16 @@ public class SentenceDetectorJob extends Job { } for (Span textBlock : textBlocks) { - Span[] sentenceSpans = sentenceDetector.sentPosDetect( + final Span[] sentenceSpans = sentenceDetector.sentPosDetect( textBlock.getCoveredText(text).toString()); - - double[] confidence = sentenceDetector.getSentenceProbabilities(); + final double[] confidence = sentenceDetector.probs(); for (int i = 0; i < sentenceSpans.length; i++) { Span sentenceSpan = sentenceSpans[i]; String sentenceText = text.substring(textBlock.getStart() + sentenceSpan.getStart(), textBlock.getStart() + sentenceSpan.getEnd()); detectedSentences.add(new PotentialAnnotation(textBlock.getStart() + sentenceSpan.getStart(), - textBlock.getStart() + sentenceSpan.getEnd(), sentenceText, - confidence[i], sentenceType)); + textBlock.getStart() + sentenceSpan.getEnd(), sentenceText, confidence[i], sentenceType)); } } }
