There's a few possible ways to approach this depending on the exact details of what you're trying to find and exactly what you mean by "2 matched tags". It'll generally involve determining some wider context within which the two different annotations need to be "matched" - in the simplest case this might be a rule like
Phase: FindInSentence
Input: Sentence
Options: control = appelt
Rule: InSentence
({Sentence contains AnnA, Sentence contains AnnB}):sent
-->
:sent.HasBothTags = {}
Or conversely you could match the AnnA and AnnB separately in one phase and use some Java RHS code to add a feature to the
containing sentence:
Phase: FindAAndB
Input: AnnA AnnB
Options: control = all
Rule: HasA
{AnnA}):match
-->
:match {
for(Annotation sentence : gate.Utils.getCoveringAnnotations(inputAS, matchAnnots, "Sentence")) {
sentence.getFeatures().put("hasAnnA", "true");
}
}
Rule: HasB
({AnnB}):match
-->
:match {
for(Annotation sentence : gate.Utils.getCoveringAnnotations(inputAS, matchAnnots, "Sentence")) {
sentence.getFeatures().put("hasAnnB", "true");
}
}
then a subsequent phase can look for
{Sentence.hasAnnA == "true", Sentence.hasAnnB == "true"}
. You can extend this technique in various ways, for example you can copy specific features up from the AnnA and AnnB annotations onto the Sentence with
sentence.getFeatures().put("somethingFromA", gate.Utils.getOnlyAnn(matchAnnots).getFeatures().get("something"));
and then use those when later matching the sentences.