Conditional statements UIMA RUTA-如何模拟IF ELSE条件?

Conditional statements UIMA RUTA-如何模拟IF ELSE条件?,conditional-statements,uima,ruta,Conditional Statements,Uima,Ruta,我目前正在尝试解决RUTA中的以下用例: If a Fragment contains one or more words from a WordlistA, then CREATE(Process, "finished" = "true") If the Fragment contains none of the words from the WordlistA, then CREATE(Process, "finished" = "false") 因此,创建的注释Process@finis

我目前正在尝试解决RUTA中的以下用例:

If a Fragment contains one or more words from a WordlistA, then CREATE(Process, "finished" = "true")
If the Fragment contains none of the words from the WordlistA, then CREATE(Process, "finished" = "false")
因此,创建的注释Process@finished应该为真或假,但决不能同时为“真”和“假”

我试过这个:

DECLARE Process (STRING finsihed);
WORDLIST WordlistA = 'mywordlist.txt';
Document{-> MARKFAST(ProcessTerm, WordlistA)};
Fragment {} -> {ProcessTerm {-> CREATE(Process, "finished" = "true")};};
Fragment {-CONTAINS(ProcessTerm) -> CREATE(Process, "finished" = "false")};
就我所见,第二条规则总是匹配的!?但是为什么呢?结果ProcessTerm@finished如果第一个规则也匹配,则注释包含“true”和“false”

使用RUTA实现用例的最佳方法是什么?在我看来,我需要像IF-ELSE这样的语句

在过去的两个小时里,用例发生了一点变化

If a **Document** contains one or more words from a WordlistA, then CREATE(Process, "finished" = "true")
If the **Document** contains none of the words from the WordlistA, then CREATE(Process, "finished" = "false")
我现在以以下方式使用Peters提案:

Document->{
  Document{CONTAINS(ProcessTerm)-> CREATE(Process, "finished" = "true")};
  Document{-PARTOF(Process) -> CREATE(Process, "finished" = "false")};
};

Ruta中还没有IF-THEN构造。最相似的是具有相互排斥条件的两个块构造。嗯,这也可以通过规则来实现

遵守你的规则: 如果第二条规则始终匹配,则每个片段注释中没有(可见的)ProcessTerm注释

在第一条规则中,为每个片段注释中的每个ProcessTerm注释创建流程注释

如果我没有误解您的描述,我会认为这可能是您正在寻找的:

Fragment {CONTAINS(ProcessTerm) -> CREATE(Process, "finished" = "true")};
Fragment {-CONTAINS(ProcessTerm) -> CREATE(Process, "finished" = "false")};
这将在所有片段注释上迭代两次,这实际上是不必要的。您还可以执行以下操作(或使用块和变量的任何变体):


DICLAIMER:我是UIMA Ruta的开发人员,Ruta中还没有IF-THEN结构。最相似的是具有相互排斥条件的两个块构造。嗯,这也可以通过规则来实现

遵守你的规则: 如果第二条规则始终匹配,则每个片段注释中没有(可见的)ProcessTerm注释

在第一条规则中,为每个片段注释中的每个ProcessTerm注释创建流程注释

如果我没有误解您的描述,我会认为这可能是您正在寻找的:

Fragment {CONTAINS(ProcessTerm) -> CREATE(Process, "finished" = "true")};
Fragment {-CONTAINS(ProcessTerm) -> CREATE(Process, "finished" = "false")};
这将在所有片段注释上迭代两次,这实际上是不必要的。您还可以执行以下操作(或使用块和变量的任何变体):


迪克莱默:我是UIMA Ruta的开发者

谢谢你的回答。带块的第二个版本实现了此功能。:-)谢谢你的回答。带块的第二个版本实现了此功能。:-)