【问题标题】:Uima ruta -AbbrevationsUima ruta - 缩写
【发布时间】:2016-08-05 23:04:28
【问题描述】:

我可以使用 Uima Ruta 分割单词的字母吗?

例如

1.(WHO)
2.(APIAs)

脚本:

DECLARE NEW;
BLOCK (foreach)CAP{}
{
W{REGEXP(".")->MARK(NEW)};

}

【问题讨论】:

    标签: uima ruta


    【解决方案1】:

    是的,这是通过 UIMA Ruta 中的 simple regex 规则实现的:

    DECLARE Char;
    CAP->{"."->Char;};
    

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

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

    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 注释,对每个迭代的覆盖文本应用正则表达式,并为匹配项创建注释。

    您当然也可以使用 BLOCK 代替内联规则。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-13
      • 2018-08-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多