GATE - JAPE规则嵌套'包含'运算符 - 正确的语法

问题描述 投票:1回答:1

当我尝试使用OR运算符创建“Sentence contains”jape规则时,即当句子包含1 OR 2 AND 3 OR 4时,我遇到错误:

(
   { 
      Sentence contains { Annotation1 | Annotation2 },  
      Sentence contains { Annotation3 | Annotation4 }
   }
)  
:temp  
--> 

有人可以建议正确的语法吗?

syntax nlp grammar gate
1个回答
3
投票

在LSH jape语法中没有类似AND运算符的东西,我们不能在上下文运算符中使用OR运算符,即;包含和内部。相反,你可以像这样编码。

(
    ({Sentence contains {Annotation1}} | {Sentence contains {Annotation2}})
    ({Sentence contains {Annotation3}} | {Sentence contains {Annotation4}})
)
:temp
-->
© www.soinside.com 2019 - 2024. All rights reserved.