首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Uima ruta -Abbrevations

Uima ruta -Abbrevations
EN

Stack Overflow用户
提问于 2016-08-02 13:46:52
回答 1查看 117关注 0票数 1

我能用Uima Ruta分割一个单词的字母吗?

例如。

代码语言:javascript
复制
1.(WHO)
2.(APIAs)

剧本:

代码语言:javascript
复制
DECLARE NEW;
BLOCK (foreach)CAP{}
{
W{REGEXP(".")->MARK(NEW)};

}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-08-05 13:36:54

是的,这是用UIMA中的简单正则表达式规则实现的:

代码语言:javascript
复制
DECLARE Char;
CAP->{"."->Char;};

您不能为此使用常规规则,因为您需要匹配比RutaBasic更小的东西。唯一的选择是使用regexp规则,它直接对文本进行操作,而不是对注释进行操作。当然,您应该非常小心,因为这会导致很多注释。

对稍微紧凑的规则的一些解释:CAP->{"."->Char;};

代码语言:javascript
复制
CAP // the only rule element of the rule: match on each CAP annotation
->{// indicates that inlined rules follow that are applied in the context of the matched annotation.
"." // a regular expression matching on each character
-> Char // the "action" of the regex rule: create an annotation of the type Char for each match of the regex 
;}; // end of regex rule, end of inlined rules, end of actual rule

总之,该规则遍历所有CAP注释,对每个迭代覆盖的文本应用正则表达式,并为匹配创建注释。

当然,您也可以使用块而不是内联规则。

免责声明:我是UIMA Ruta的开发人员

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38722273

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档