Wow, this could make some of my collection readers much much simpler.

-- Jens

On Thu, Jul 16, 2015 at 8:27 PM, Richard Eckart de Castilho <[email protected]>
wrote:

> On 16.07.2015, at 19:46, Marshall Schor <[email protected]> wrote:
>
> > The usual way these kinds of things have been decided is to "guess" if
> the more
> > likely scenario is one of a user error, or a user intent.  Here, the
> user seemed
> > to intend this.  If this was supported, there might be other unintended
> > consequences - such as setting a subject-of-analysis **after** some
> Annotations
> > were made.
>
> Well, actually *that* is a case that should be considered supported.
>
> E.g. uimaFIT comes with a JCasBuilder class that allows to incrementally
> initialize a CAS, e.g:
>
>     JCasBuilder jb = new JCasBuilder(jCas);
>     jb.add("This sentence is not annotated. ");
>     jb.add("But this sentences is annotated. ", Sentence.class);
>     int begin = jb.getPosition();
>     jb.add("And", Token.class);
>     jb.add(" ");
>     jb.add("here", Token.class);
>     jb.add(" ");
>     jb.add("every", Token.class);
>     jb.add(" ");
>     jb.add("token", Token.class);
>     jb.add(" ");
>     jb.add("is", Token.class);
>     jb.add(".", Token.class);
>     jb.add(begin, Sentence.class);
>     jb.close();
>
> The annotations are added directly to the CAS while the strings are
> added to an internal StringBuilder which is only set as the CAS
> document text when close() is called.
>
> Very useful I might mention! I use the same technique in various readers.
>
> Cheers,
>
> -- Richard

Reply via email to