You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@uima.apache.org by José Tomás Atria <jt...@gmail.com> on 2015/01/24 22:25:13 UTC

Selecting all connected annotations by type.

Hello all,

I am looking for the best approach to select all annotations of a given
type that intersect an annotation of a different type.

I am aware of selectCovered and selectCovering, which, as far as I
understand, will select all annotations (of a given type) that cover ranges
of text which are, respectively, subsets or supersets of another
annotation. Is there a similar method for annotations that cover ranges
which merely _intersect_ with the range covered by a given annotation?

What would the recommended way of achieving this?

Any help would be apreciated. Thanks!
jta.

-- 
entia non sunt multiplicanda praeter necessitatem

Re: Selecting all connected annotations by type.

Posted by José Tomás Atria <jt...@gmail.com>.
Hi Jens,

I did indeed use those methods for a while and they were working fine, but
I was mostly using them to perform sanity checks on some arbitrary span
annotations, and once I made sure those were being created OK I reverted
back to stock uima-fit.

They should be ok, though; the patch basically adds very little variation
on Richard's methods for indexing covered/covering annotations, and while I
was using them, they worked.

Funny coincidence: Just a few days ago I was thinking that it would be
possible to provide most of the indexing features of CASUtil via interval
trees. No idea about how expensive this would be, though. This may be a
good direction to look into if you happen to feel inclined to rewrite those
methods :)

Best,
jta



On Mon, Oct 26, 2015 at 11:58 AM, Jens Grivolla <j+...@grivolla.net> wrote:

> Ok Richard, I'll look into it, but I don't promise anything at this point
> (tons of project deliverables coming up)...
>
> -- Jens
>
> On Fri, Oct 23, 2015 at 2:03 PM, Richard Eckart de Castilho <
> rec@apache.org>
> wrote:
>
> > Hi Jens,
> >
> > :) don't you want to test and apply it? My next projected time slot for
> > uimaFIT is in December.
> >
> > Best,
> >
> > -- Richard
> >
> > > On 23.10.2015, at 11:09, Jens Grivolla <j+...@grivolla.net> wrote:
> > >
> > > I'd really like to have that functionality also (we'll need to do
> > something
> > > like that quite soon), so I just voted on the issue...
> > >
> > > I haven't tested the patch yet. José, have you been using this over the
> > > last few months?
> > >
> > > -- Jens
> >
> >
>



-- 
entia non sunt multiplicanda praeter necessitatem

Re: Selecting all connected annotations by type.

Posted by Jens Grivolla <j+...@grivolla.net>.
Ok Richard, I'll look into it, but I don't promise anything at this point
(tons of project deliverables coming up)...

-- Jens

On Fri, Oct 23, 2015 at 2:03 PM, Richard Eckart de Castilho <re...@apache.org>
wrote:

> Hi Jens,
>
> :) don't you want to test and apply it? My next projected time slot for
> uimaFIT is in December.
>
> Best,
>
> -- Richard
>
> > On 23.10.2015, at 11:09, Jens Grivolla <j+...@grivolla.net> wrote:
> >
> > I'd really like to have that functionality also (we'll need to do
> something
> > like that quite soon), so I just voted on the issue...
> >
> > I haven't tested the patch yet. José, have you been using this over the
> > last few months?
> >
> > -- Jens
>
>

Re: Selecting all connected annotations by type.

Posted by Richard Eckart de Castilho <re...@apache.org>.
Hi Jens,

:) don't you want to test and apply it? My next projected time slot for
uimaFIT is in December.

Best,

-- Richard

> On 23.10.2015, at 11:09, Jens Grivolla <j+...@grivolla.net> wrote:
> 
> I'd really like to have that functionality also (we'll need to do something
> like that quite soon), so I just voted on the issue...
> 
> I haven't tested the patch yet. José, have you been using this over the
> last few months?
> 
> -- Jens


Re: Selecting all connected annotations by type.

Posted by Jens Grivolla <j+...@grivolla.net>.
I'd really like to have that functionality also (we'll need to do something
like that quite soon), so I just voted on the issue...

I haven't tested the patch yet. José, have you been using this over the
last few months?

-- Jens

On Sun, Feb 1, 2015 at 2:04 AM, José Tomás Atria <jt...@gmail.com> wrote:

> Issue created, patch submitted.
>
> https://issues.apache.org/jira/browse/UIMA-4212
>
> On Sat Jan 31 2015 at 3:12:33 AM Richard Eckart de Castilho <
> rec@apache.org>
> wrote:
>
> > Dear José,
> >
> > could you please re-submit the patch via the Apache UIMA issue tracker:
> >
> > Thanks!
> >
> > -- Richard
> >
> > https://issues.apache.org/jira/browse/UIMA
> >
> > On 31.01.2015, at 05:38, José Tomás Atria <jt...@gmail.com> wrote:
> >
> > > Please disregard the previous patch, apparently I managed to corrupt it
> > while creating it over ssh.
> > >
> > > The version in this email should be correct, I hope.
> > >
> > > Best,
> > > jta
> >
> >
>

Re: Selecting all connected annotations by type.

Posted by José Tomás Atria <jt...@gmail.com>.
Issue created, patch submitted.

https://issues.apache.org/jira/browse/UIMA-4212

On Sat Jan 31 2015 at 3:12:33 AM Richard Eckart de Castilho <re...@apache.org>
wrote:

> Dear José,
>
> could you please re-submit the patch via the Apache UIMA issue tracker:
>
> Thanks!
>
> -- Richard
>
> https://issues.apache.org/jira/browse/UIMA
>
> On 31.01.2015, at 05:38, José Tomás Atria <jt...@gmail.com> wrote:
>
> > Please disregard the previous patch, apparently I managed to corrupt it
> while creating it over ssh.
> >
> > The version in this email should be correct, I hope.
> >
> > Best,
> > jta
>
>

Re: Selecting all connected annotations by type.

Posted by Richard Eckart de Castilho <re...@apache.org>.
Dear José,

could you please re-submit the patch via the Apache UIMA issue tracker:

Thanks!

-- Richard

https://issues.apache.org/jira/browse/UIMA

On 31.01.2015, at 05:38, José Tomás Atria <jt...@gmail.com> wrote:

> Please disregard the previous patch, apparently I managed to corrupt it while creating it over ssh.
> 
> The version in this email should be correct, I hope.
> 
> Best,
> jta


Re: Selecting all connected annotations by type.

Posted by José Tomás Atria <jt...@gmail.com>.
Please disregard the previous patch, apparently I managed to corrupt it
while creating it over ssh.

The version in this email should be correct, I hope.

Best,
jta

On Fri Jan 30 2015 at 11:09:10 PM José Tomás Atria <jt...@gmail.com>
wrote:

> Dear Richard:
>
> I am attaching a patch with a series of selectIntersects and
> indexIntersects methods. There's more signatures than the corresponding
> selectCovered/Covering methods, as "intersects" could include covering
> annotations or not. If they are excluded, the methods use the same approach
> you used in selecCovered, advancing the iterator. Otherwise, they defer to
> the int interval method used in selectCovering.
>
> Maybe this is useful to someone else besides myself?
>
> Also, I have no experience with unit testing, so I didn't even try adding
> to add tests for the new methods. I did some naive testing by hand, and it
> seems to work... but I'm particularly bad with interval operations, so I
> wouldn't be surprised if I made some egregious error. My apologies in
> advance.
>
> Best,
> jta
>
>
> On Mon Jan 26 2015 at 3:19:37 PM José Tomás Atria <jt...@gmail.com>
> wrote:
>
>> Cool, I'll look into ti and let you know if I manage to make something
>> useful. Thanks for the tips.
>>
>> On Sun Jan 25 2015 at 12:47:52 PM Richard Eckart de Castilho <
>> rec@apache.org> wrote:
>>
>>> Hi José,
>>>
>>> we had no need for such a method so far ;) The easiest way would
>>> probably be to copy the
>>> selectCovering method from uimaFIT and adjust it to catch all
>>> intersecting annotations.
>>> You can probably add an optimization to a selectIntersecting method
>>> which breaks the loop as soon as the begin offset of an annotation is
>>> larger than the end offset of your intersection range.
>>>
>>> Cheers,
>>>
>>> -- Richard
>>>
>>> On 24.01.2015, at 22:25, José Tomás Atria <jt...@gmail.com> wrote:
>>>
>>> > Hello all,
>>> >
>>> > I am looking for the best approach to select all annotations of a given
>>> > type that intersect an annotation of a different type.
>>> >
>>> > I am aware of selectCovered and selectCovering, which, as far as I
>>> > understand, will select all annotations (of a given type) that cover
>>> ranges
>>> > of text which are, respectively, subsets or supersets of another
>>> > annotation. Is there a similar method for annotations that cover ranges
>>> > which merely _intersect_ with the range covered by a given annotation?
>>> >
>>> > What would the recommended way of achieving this?
>>> >
>>> > Any help would be apreciated. Thanks!
>>> > jta.
>>> >
>>> > --
>>> > entia non sunt multiplicanda praeter necessitatem
>>>
>>>

Re: Selecting all connected annotations by type.

Posted by José Tomás Atria <jt...@gmail.com>.
Dear Richard:

I am attaching a patch with a series of selectIntersects and
indexIntersects methods. There's more signatures than the corresponding
selectCovered/Covering methods, as "intersects" could include covering
annotations or not. If they are excluded, the methods use the same approach
you used in selecCovered, advancing the iterator. Otherwise, they defer to
the int interval method used in selectCovering.

Maybe this is useful to someone else besides myself?

Also, I have no experience with unit testing, so I didn't even try adding
to add tests for the new methods. I did some naive testing by hand, and it
seems to work... but I'm particularly bad with interval operations, so I
wouldn't be surprised if I made some egregious error. My apologies in
advance.

Best,
jta


On Mon Jan 26 2015 at 3:19:37 PM José Tomás Atria <jt...@gmail.com> wrote:

> Cool, I'll look into ti and let you know if I manage to make something
> useful. Thanks for the tips.
>
> On Sun Jan 25 2015 at 12:47:52 PM Richard Eckart de Castilho <
> rec@apache.org> wrote:
>
>> Hi José,
>>
>> we had no need for such a method so far ;) The easiest way would probably
>> be to copy the
>> selectCovering method from uimaFIT and adjust it to catch all
>> intersecting annotations.
>> You can probably add an optimization to a selectIntersecting method which
>> breaks the loop as soon as the begin offset of an annotation is larger than
>> the end offset of your intersection range.
>>
>> Cheers,
>>
>> -- Richard
>>
>> On 24.01.2015, at 22:25, José Tomás Atria <jt...@gmail.com> wrote:
>>
>> > Hello all,
>> >
>> > I am looking for the best approach to select all annotations of a given
>> > type that intersect an annotation of a different type.
>> >
>> > I am aware of selectCovered and selectCovering, which, as far as I
>> > understand, will select all annotations (of a given type) that cover
>> ranges
>> > of text which are, respectively, subsets or supersets of another
>> > annotation. Is there a similar method for annotations that cover ranges
>> > which merely _intersect_ with the range covered by a given annotation?
>> >
>> > What would the recommended way of achieving this?
>> >
>> > Any help would be apreciated. Thanks!
>> > jta.
>> >
>> > --
>> > entia non sunt multiplicanda praeter necessitatem
>>
>>

Re: Selecting all connected annotations by type.

Posted by José Tomás Atria <jt...@gmail.com>.
Cool, I'll look into ti and let you know if I manage to make something
useful. Thanks for the tips.

On Sun Jan 25 2015 at 12:47:52 PM Richard Eckart de Castilho <re...@apache.org>
wrote:

> Hi José,
>
> we had no need for such a method so far ;) The easiest way would probably
> be to copy the
> selectCovering method from uimaFIT and adjust it to catch all intersecting
> annotations.
> You can probably add an optimization to a selectIntersecting method which
> breaks the loop as soon as the begin offset of an annotation is larger than
> the end offset of your intersection range.
>
> Cheers,
>
> -- Richard
>
> On 24.01.2015, at 22:25, José Tomás Atria <jt...@gmail.com> wrote:
>
> > Hello all,
> >
> > I am looking for the best approach to select all annotations of a given
> > type that intersect an annotation of a different type.
> >
> > I am aware of selectCovered and selectCovering, which, as far as I
> > understand, will select all annotations (of a given type) that cover
> ranges
> > of text which are, respectively, subsets or supersets of another
> > annotation. Is there a similar method for annotations that cover ranges
> > which merely _intersect_ with the range covered by a given annotation?
> >
> > What would the recommended way of achieving this?
> >
> > Any help would be apreciated. Thanks!
> > jta.
> >
> > --
> > entia non sunt multiplicanda praeter necessitatem
>
>

Re: Selecting all connected annotations by type.

Posted by Richard Eckart de Castilho <re...@apache.org>.
Hi José,

we had no need for such a method so far ;) The easiest way would probably be to copy the
selectCovering method from uimaFIT and adjust it to catch all intersecting annotations.
You can probably add an optimization to a selectIntersecting method which breaks the loop as soon as the begin offset of an annotation is larger than the end offset of your intersection range.

Cheers,

-- Richard

On 24.01.2015, at 22:25, José Tomás Atria <jt...@gmail.com> wrote:

> Hello all,
> 
> I am looking for the best approach to select all annotations of a given
> type that intersect an annotation of a different type.
> 
> I am aware of selectCovered and selectCovering, which, as far as I
> understand, will select all annotations (of a given type) that cover ranges
> of text which are, respectively, subsets or supersets of another
> annotation. Is there a similar method for annotations that cover ranges
> which merely _intersect_ with the range covered by a given annotation?
> 
> What would the recommended way of achieving this?
> 
> Any help would be apreciated. Thanks!
> jta.
> 
> -- 
> entia non sunt multiplicanda praeter necessitatem