[ 
https://issues.apache.org/jira/browse/UIMA-6153?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16987678#comment-16987678
 ] 

Richard Eckart de Castilho commented on UIMA-6153:
--------------------------------------------------

For the time being, I have resorted to using this form:
Annotation c = cas.select(myTypeForTokenClass).<Annotation>at(2, 3).get(0);
Note that I am using *Annotation* here instead of *Token* and *CAS* instead of 
*JCas* since I don't want to pay the overhead of JCas being initialized.

In an ad-hoc non-scientific situation I was trying out CAS vs JCas and found 
that using JCas made the test run ~500ms longer which I would attribute to the 
initialization overhead - but note that I didn't yet get around to 
systematically investigate this. I'll post when I had more time to figure the 
performance difference out.

> select.covering should bind to AnnotationFS
> -------------------------------------------
>
>                 Key: UIMA-6153
>                 URL: https://issues.apache.org/jira/browse/UIMA-6153
>             Project: UIMA
>          Issue Type: Improvement
>          Components: UIMA
>    Affects Versions: 3.1.1SDK
>            Reporter: Richard Eckart de Castilho
>            Priority: Major
>
> The following code does not compile because select.covering() uses TOP 
> instead of AnnotationFS as the generic type. Consequently, getBegin() and 
> getEnd() are not available on the "s" used in the filter expressions. But 
> since covering() only makes sense for annotations, binding the generic type 
> to TOP doesn't seem to make much sense:
> {{return aCas.select(getType(aCas, Sentence.class)).covering(aBegin1, 
> aBegin1)}}
> {{    .filter(s -> s.getBegin() <= aBegin1 && aBegin1 < s.getEnd())}}
> {{    .filter(s -> s.getBegin() <= aBegin2 && aBegin2 < 
> s.getEnd()).findFirst()}}
> {{    .isPresent();}}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to