opennlp-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jörn Kottmann <>
Subject Re: ChunkSample class
Date Tue, 25 Jan 2011 16:27:43 GMT
On 1/25/11 5:18 PM, William Colen wrote:
> Hi,
> I was looking at the ChunkSample class, it is doing lots of List to Array
> conversions. I tought it was not necessary, but I'm not sure. Other classes
> are doing the same, like NameSample class. Is there a reason for doing that
> instead of using arrays directly?

Yes, the ChunkSample class is immutable and needs to encapsulate the arrays.
If it would just hand out the array someone could modify it, but this we 
do not want.

It its always good to have immutable classes, but yes it is slower since 
we need
to make two copies just to ensure that. In the end I think we do not 
loose much time here
during training. Immutable object are also thread safe which will be 
important as soon as
we have multi-threaded training code.

So it was simply a design decision when we made it, that these XSample 
should be immutable.


View raw message