Pampac #129
-
One of the reasons to use GateNlp was Pampac. I find powerful the capacity to merge different kinds of annotations in the matching. Now I'm facing a "simple" problem: Detec sentences that start with a Number and a : like I tried with:
But does not detect nothing (if I remove AnnAt("Sentence") then I get some matches (some of them not at the begining) Thanks!! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Could you please describe more exactly the pattern you intend to match? In order to match an annotation at the beginning of a sentence you need a construct like Ann("Token", features=dict(is_digit=True)).at("Sentence") Note that the difference between BTW it is usually a good idea to restrict the input set to only annotations that are actually ever matched in a rule. In your case something like this may work: r2 = Rule(
Seq(
AnnAt("Token", features=dict(is_digit=True)).at("Sentence"),
Ann("Token", features=dict(lemma=".")) , name="seq2"),
AddAnn(name="seq2", type="RefNum")
) |
Beta Was this translation helpful? Give feedback.
Could you please describe more exactly the pattern you intend to match?
I notice that the rule you try will look for, in order, a Sentence annotation, then Token annotation with the is_digit feature then a Token annotation withe lemma="." feature. But I think you want to match a Token that starts together with a sentence and has the is_digit feature true followed by another token etc.
In order to match an annotation at the beginning of a sentence you need a construct like
Note that the difference between
Ann
andAnnAt
relates to something different: the annotations in the input set form a specific sequence, and even if e.g. Ann1 an…