JDK-4143071 : Sentence BreakIterator has trouble with sentence which end with a date/number
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.text
  • Affected Version: 1.1.6
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_2.6
  • CPU: sparc
  • Submitted: 1998-05-27
  • Updated: 1998-07-30
  • Resolved: 1998-07-30
Related Reports
Duplicate :  
Description

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)
======================================================================

Comments
EVALUATION This problem was fixed by the fix for bug #4158381, so I'm closing this bug as a duplicate of that one. richard.gillam@eng 1998-07-30
30-07-1998