user2910192
user2910192

Reputation: 41

Overlapping annotations in GATE

I am trying to merge two annotations in a document and that works fine but I want to select only the annotations which are common to both of them e.g. one annotation highlights a sentence "I am testing my grammar" and the second annotation highlights "testing my grammar". The second annotation also highlights "testing my grammar" at some other place but I dont want to pick that since its not highlighted by the first annotation.

I would like to figure out a way of picking up just the common part. I am using GATE 7.1 and have used normal PRs along with one Annotation Merging PR. Is there some way by which I can create a feature which somehow shows that both annotations have been used?

Thanks

Upvotes: 0

Views: 559

Answers (1)

Yasen
Yasen

Reputation: 1683

You can use a jape transducer with operator "within", described here.

Here's a simple rule which will match only Ann2 (testing my ..) when it's within another annotation Ann1 (I am testing my ...)

Phase: phrase
Input: Ann1 Ann2
Options: control = appelt

Rule: ann2WithinAnn1
(
   ({Ann2 within Ann1})
):aa
--> :aa.Overlap = {}

Keep in mind that partial overlaps are harder to catch with jape (or at least I don't know how) for instance:

Ann1 on "I am testing".
Ann2 on "testing my grammar".

Upvotes: 2

Related Questions