interesting, I did not know that... :-)

-Marshall

On 7/16/2015 2:27 PM, Richard Eckart de Castilho 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