UIMA Ruta创建注释,其功能由一些文本分隔 [英] UIMA Ruta Creating annotation with features separated by some text

查看:167
本文介绍了UIMA Ruta创建注释,其功能由一些文本分隔的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些带有注释的文本,如下所示:

I have some text with annotations created like the following:

wewf.werwfwef. wewfwefwwew. wefewefwff
AnnotationA
asdfawece aefae eafewfaefa aefafe ceaewfae
adfcaecae acaeaet aegaegageg caeacdaefa
AnnotationB
sadaeceaee aef aewfaegg rresf ceeaefaeaeaf
adfcaecae acaeaet aegaegageg caeacdaefa
AnnotationA
adfcaecae acaeaet aegaegageg caeacdaefa
adfcaecae acaeaet aegaegageg caeacdaefa
AnnotationB
adfcaecae acaeaet aegaegageg caeacdaefa
adfcaecae acaeaet aegaegageg caeacdaefa

我想创建一个以AnnotationA及其最接近的AnnotationB为特征的注释.我应该如何用Ruta表达这一点?

I want to create an annotation with AnnotationA and its closest AnnotationB as features. How should I express this in Ruta?

我尝试了以下不正确的方法:

I have tried the following incorrect way:

DECLARE Annotation TargetAnnotation (AnnotationA ana, AnnotationB anb);
Document {-> CREATE(TargetAnnotation, "ana" = AnnotationA, "anb" = AnnotationB)};

规则覆盖整个文档.我要的是使用AnnotationA及其最接近的AnnotationB作为功能的注释. 非常感谢您的回答.

The rule covers the whole document. What I just want is annotation with AnnotationA and its closest AnnotationB as feature. Thanks very much for any answer.

推荐答案

在UIMA Ruta中有几种指定方法,它们主要取决于创建的TargetAnnotation应该获得的偏移量. CREATE操作使用由rule元素匹配的范围来标识要素的值.

There are several ways to specify this in UIMA Ruta and they mainly depend on the offset the created TargetAnnotation should get. The CREATE action uses the span matched by the rule element in order to identify the values for the features.

如果创建的注释的偏移量并不重要,那么您可以简单地将跨度结合使用两个注释AnnotationA和AnnotationB:

If the offsets of the created annotation do not really matter, then you can simply use the span combining both annotations AnnotationA and AnnotationB:

(AnnotationA # AnnotationB){-> CREATE(TargetAnnotation, "ana" = AnnotationA, "anb" = AnnotationB)};

请注意,此规则在两个注释之间引入了顺序依赖性.您还可以指定无关紧要的规则,但是它们可能会返回太多匹配项.这取决于您要完成什么.

Mind that this rule introduces a sequential dependency between the two annotations. You can also specify rules that do not care, but they will probably return too many matches. It depends on what you want to accomplish.

如果创建的注释的偏移量应等于提供的注释之一,例如AnnotationA,则应使用GATHER而不是CREATE. GATHER允许您指定应将匹配项分配给功能的rule元素的索引.

If the offset of the created annotation should equal one of the provided annotations, e.g., AnnotationA, then you should use GATHER instead of CREATE. GATHER allows one to specify the index of the rule element whose match should be assigned to the feature.

 AnnotationA{-> GATHER(TargetAnnotation, "ana" = 1, "anb" = 3)} # AnnotationB;

(我是UIMA Ruta的开发人员)

这篇关于UIMA Ruta创建注释,其功能由一些文本分隔的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆