[Date Prev][Date Next][Thread Prev][Thread Next][Author Index][Date Index][Thread Index]

Re: [zzdev] java.text.BreakIterator



On Wed, 22 Nov 2000, Benjamin Fallenstein wrote:

> Tuomas Lukka wrote:
> > 
> > > Just noted: why don't we use java.text.BreakIterator? It can break lines
> > > as well as words and sentences, and it can do so in a localized way.
> > > Plus, it's standard JDK 1.1. As long as we stay on the Java platform,
> > > why not use the intelligence that's there?
> > 
> > No, it can only break strings. Breaking by lines is only in 1.2.
> 
> The 1.1 API documentation speaks of a line-breaking instance which finds
> possible line breaks. (I just stumbled over it in the docs, didn't try
> it out yet.) Doesn't that work, or what?

Yes, it finds where the next space is. It's not too difficult to do
manually either, as you have done in FText. ;)

> > Also, we want special definition of sentence: the separator of sentences
> > is two spaces.
> 
> (btw, don't you think sentences should be stored structurally -- e.g.
> one cell each or something? It makes sense to me to enter them with two
> spaces, but it makes less sense to me not to have them represent the
> sentences: that means I can't use two spaces just as two spaces, which
> seems kind of limiting, and: what do three spaces in a row mean?)

We've thought about this long and hard here and discussed it with Ted.
There are very good reasons for doing this for sentences but using
structure for paragraphs.

Most importantly, this makes it very easy to write a script that goes
through the stream and looks for something. 

Second, we don't want to force things to be a whole cell: when I have
something like

	"As seen in Figure 1, the blah blah blah"

where Figure 1 would be one cell that would be connected to the actual
figure.

Two spaces works well in just the plain string, too.

Three spaces in a row don't need to mean anything - I'd guess a sentence
break as well would be most logical.

The idea of Nile is that it's structured enough so that you won't actually
need two spaces anywhere. Where would you want to use two spaces as two
spaces?

> > Breaking at these is the simple part. The complicated part is figuring out
> > how to make it easy for the user to manipulate objects at these levels.
> 
> Well, ok, I see. So it's not useful for nile.

Right.

	Tuomas