You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ctakes.apache.org by Shady Hussein <sh...@gmail.com> on 2013/02/04 13:48:03 UTC

Annotations of a token

Dear All,
  Is there a way to get all the annotations of a single token?. I want to
loop on tokens inside a sentence and get all the annotations on this token,
in a similar fashion like the GUI. I would be grateful, cause this will
make my life easier to differentiate between annotations. Thanks for your
cooperation

-- 
Thanks and best Regards,

Shady AbdelAziz

Re: Annotations of a token

Posted by Shady Hussein <sh...@gmail.com>.
Hi Pei,
   Thanks so much for this information. Yes this helped me a lot, I tried
it and it is working. I only need to filter it with Class<T extends
Annotation> then check if the list is empty or not. Thanks again

On Mon, Feb 4, 2013 at 4:29 PM, Chen, Pei <Pe...@childrens.harvard.edu>wrote:

> Hi Shady,
> uimaFIT (included as a dependency by cTAKES) has a bunch of JCasUtil's
> that allows you to select by type or begin/end spans..
> For example:
> for (Sentence sentence : JCasUtil.select(jCas, Sentence.class)) {
>           List<? extends Annotation> blah = JCasUtil.selectCovered(
>               goldView, argClass, goldArg);     ...
> }
>
> Hope that helps.
>
> > -----Original Message-----
> > From: Shady Hussein [mailto:shady.aziz@gmail.com]
> > Sent: Monday, February 04, 2013 7:49 AM
> > To: ctakes-dev@incubator.apache.org
> > Subject: Annotations of a token
> >
> > Dear All,
> >   Is there a way to get all the annotations of a single token?. I want
> to loop on
> > tokens inside a sentence and get all the annotations on this token, in a
> similar
> > fashion like the GUI. I would be grateful, cause this will make my life
> easier to
> > differentiate between annotations. Thanks for your cooperation
> >
> > --
> > Thanks and best Regards,
> >
> > Shady AbdelAziz
>



-- 
Thanks and best Regards,

Shady AbdelAziz

RE: Annotations of a token

Posted by "Chen, Pei" <Pe...@childrens.harvard.edu>.
Hi Shady,
uimaFIT (included as a dependency by cTAKES) has a bunch of JCasUtil's that allows you to select by type or begin/end spans..
For example:
for (Sentence sentence : JCasUtil.select(jCas, Sentence.class)) {
          List<? extends Annotation> blah = JCasUtil.selectCovered(
              goldView, argClass, goldArg);     ...
}

Hope that helps.

> -----Original Message-----
> From: Shady Hussein [mailto:shady.aziz@gmail.com]
> Sent: Monday, February 04, 2013 7:49 AM
> To: ctakes-dev@incubator.apache.org
> Subject: Annotations of a token
> 
> Dear All,
>   Is there a way to get all the annotations of a single token?. I want to loop on
> tokens inside a sentence and get all the annotations on this token, in a similar
> fashion like the GUI. I would be grateful, cause this will make my life easier to
> differentiate between annotations. Thanks for your cooperation
> 
> --
> Thanks and best Regards,
> 
> Shady AbdelAziz