-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.1.6
-
sparc
-
solaris_2.6
Name: tb29552 Date: 05/27/98
A BreakIterator retrieved by getSentenceInstance()
doesn't find a sentence break if the sentence ends
with a number. For example, there is only a single
sentence in the following. There should be three:
"Today is the 27th of May, 1998. Tomorrow will be 28 May 1998. The day after will be the 30th."
Here's a simple program:
import java.text.BreakIterator;
public class bug
{
public static void main(String args[])
{
int pos = 0;
String theText = "Today is the 27th of May, 1998. Tomorrow will be 28 May 1998. The day after will be the 30th.";
BreakIterator breaks = BreakIterator.getSentenceInstance();
breaks.setText(theText);
while (pos != BreakIterator.DONE) {
pos = breaks.next();
System.out.println("Sentence Break at " + pos);
}
}
}
The output is
Sentence Break at 93
Sentence Break at -1
I'd like to see
Sentence Break at 31
Sentence Break at 61
Sentence Break at 93
Sentence Break at -1
This has been tested using default Locales of en
and en_AU.
(Review ID: 32445)
======================================================================
- duplicates
-
JDK-4158381 sentence BreakIterator stops too soon (more)
-
- Closed
-