You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "timgrein (via GitHub)" <gi...@apache.org> on 2024/03/09 09:24:50 UTC
[PR] Fix middle of sentence calculation in OpenNLPSentenceBreakIterator.preceding [lucene]
timgrein opened a new pull request, #13170:
URL: https://github.com/apache/lucene/pull/13170
The method [`preceding`](https://github.com/apache/lucene/blob/6445bc0a14ee22d107c072f4ef7b133faf780fe1/lucene/analysis/opennlp/src/java/org/apache/lucene/analysis/opennlp/OpenNLPSentenceBreakIterator.java#L151) and [`following`](https://github.com/apache/lucene/blob/6445bc0a14ee22d107c072f4ef7b133faf780fe1/lucene/analysis/opennlp/src/java/org/apache/lucene/analysis/opennlp/OpenNLPSentenceBreakIterator.java#L89) calculate the middle of a sentence differently. If the input text contains two sentences trying to get the preceding sentence to the second sentence will lead to an `ArrayIndexOutOfBoundsException` in this [line](https://github.com/apache/lucene/blob/6445bc0a14ee22d107c072f4ef7b133faf780fe1/lucene/analysis/opennlp/src/java/org/apache/lucene/analysis/opennlp/OpenNLPSentenceBreakIterator.java#L103) as `currentSentence` will be `1` and `currentSentence + 1` will be `2`, which is out of bounds by 1.
I've added a test case, which fails for the old logic and passes for the new logic.
Closes https://github.com/apache/lucene/issues/12210.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [PR] Fix middle of sentence calculation in OpenNLPSentenceBreakIterator.preceding [lucene]
Posted by "tteofili (via GitHub)" <gi...@apache.org>.
tteofili merged PR #13170:
URL: https://github.com/apache/lucene/pull/13170
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org