UIMA Ruta:通过在普通Java中组合现有注释的功能来创建新注释

时间:2017-02-13 20:34:29

标签: java annotations uima ruta

我正在尝试将以下逻辑转换为UIMA Ruta规则:

Sentence {->NewAnnotation} IF Sentence.part1 包含 Constituent.label="VB" AND Sentence.part2 包含 Constituent.label="VBZ"

换句话说,我需要在整个句子中创建一个新的注释,其功能 part1 (和 part2 )包含组合/序列具体的标签(Constituent.label)。

首先,我的直观答案是以下列方式使用CONTAINS条件和STRINGLIST(和配置参数):

STRINGLIST posList; //assuming it is declared
Sentence{-> NewAnnotation} <-{Sentence.part1{CONTAINS(posList, Constituent.label)};};

但它不会产生任何注释(但它不会失败)。

然后我通过将GETFEATURE功能(Sentence)存储在字符串变量中并单独使用(在主规则中)来考虑Sentence.part1操作。但是,由于GETFEATURESTRING格式保存了该功能,因此我无法使用它来生成注释(因为我需要ANNOTATION类型)。 MATCHEDTEXT行动也是如此。

我理解想要构建的规则非常复杂,但我相信Ruta是最适合此类任务的选项。所以,您能否建议我如何处理我的问题?

1 个答案:

答案 0 :(得分:2)

正如@PeterKluegl已经说过,原问题的解决方案是:

matchingTargets: [TRSS190E, TRSP1143, TRSM0146]
replacements: [TRST0822, TRSP6644, TRSM1273]
targets: [TRSS190E, TRSP1143, TRSM0146]
Hey there! I think TRST0822 is a very important parameter for the rover. Because the Martian atmosphere also requires TRST0822 and TRST0822 for it's platform and mobility subsystems.
Hey there! I think TRSP6644 is a very important parameter for the rover. Because the Martian atmosphere also requires TRSP6644 and TRSP6644 for it's platform and mobility subsystems.
Hey there! I think TRSM1273 is a very important parameter for the rover. Because the Martian atmosphere also requires TRSM1273 and TRSM1273 for it's platform and mobility subsystems.
Hey there! I think TRSM1273 is a very important parameter for the rover. Because the Martian atmosphere also requires TRSM1273 and TRSM1273 for it's platform and mobility subsystems.

请注意,只有当Sentence{-> NewAnnotation} <-{Sentence.part1<-{Constituent.label=="VB";} % Sentence.part2<-{Constituent.label=="VB";};}; 功能(即Sentence)是注释而不是我的情况下的字符串时,此规则才有效。

因此,对于潜在的感兴趣的人,我也发布了我的案例中提出的解决方案:

  • part1个功能存储在单独的注释中,但保留Sentence及其父Sentence.part1之间的链接(这可以通过父指针在UIMA中实现)。
  • 应用以下规则:

    Sentence

希望这可以提供任何帮助。