java - UIMA ruta - 使用来自不同 View 的注释

标签 java uima ruta

我有一个文档,经过一些注释后,我正在使用 HTMLConverter 将它写入一个新 View

示例输入:

<p class="MsoNormal"><span data-bkmark="para10121"></span><span style="font-family:Arial; font-size:10pt; color:#color: #000000">[1] SJ. Goetsch,BD. Murphy,R. Schmidt,et al. "Physics of rotating gamma systems for stereotactic radiosurgery. "</span> <span style="font-family:Arial; font-size:10pt; color:#color: #000000">International Journal of Radiation Oncologybiologyphysics,</span> vol.<span style="font-family:Arial; font-size:10pt; color:#color: #000000">43, no.3, pp.689-696, 1999.</span><span data-bkmark="para10121"></span></p>

我正在使用 htmlconvertor 创建一个新 View “plaintextview”

 CONFIGURE(HtmlAnnotator, "onlyContent" = false);
                 Document{-> EXEC(HtmlAnnotator)};
                 Document { -> CONFIGURE(HtmlConverter, "inputView" = "_InitialView","outputView" = "plaintextview"),
                 EXEC(HtmlConverter,{TAG})};

之后我将运行我自己的引擎并执行一些手动注释

try {
          for (AnnotationFS afs : CasUtil.select(cas.getView("plaintextview"), type))
          {
            Feature bookmarkFtr = type.getFeatureByBaseName("RefBookmark");
            System.out.println("\n Ref is " + afs.getCoveredText());
            System.out.println("STart is " + afs.getBegin());
            System.out.println("End is " + afs.getEnd());
            String test = " vol.43, no.3, pp.689-696, 1999.";
            if (afs.getCoveredText().contains(test)) {
              int start = afs.getCoveredText().indexOf(test) + afs.getBegin();
              int end = start + test.length();
              testanno annotation = new testanno(cas.getView("plaintextview").getJCas());
              annotation.setBegin(start);             
              annotation.setEnd(end);
              annotation.addToIndexes();
              
            }
          }
        }
        catch (Exception e)
        {
          e.printStackTrace();
        }

此代码将注释 plaintextview 中的特定文本(为什么? - 因为 _initialview 文档将在文本之间有 html 跨度 ex: vol.43, no.3, <一些 html 标签 > pp. 689-696, 1999.)

那么,如何使用来自不同 View (即 _initialview 和 plaintextview)的注释将我的注释从纯 TextView 获取到初始 View 或在我的 ruta 脚本中使用这些注释?

最佳答案

在 Ruta 中,您不能直接为特定的 CAS View 编写规则。 (您可以使用 EXEC 在 Ruta 脚本中的不同 View 上应用分析引擎。)

解决这个问题的正常方法是在框架级别通过在聚合分析引擎中应用沙发映射或将 View 复制到新 CAS 的 _initialView。

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

关于java - UIMA ruta - 使用来自不同 View 的注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52969512/

相关文章:

java - 为什么 getScaledInstance() 不起作用?

java - 如何在 Spigot 1.13.2 的消息中返回 block 类型

java - Android 的 HttpResponse 和超时

java - UIMA 鲁塔 : set feature with MARKONCE action

apache - 文档不明确,使用以下之一代替 : org. apache.uima.ruta.type.Document uima.tcas.DocumentAnnotation

java - Switch 设置为 int 参数。创建默认情况以排除字符串,这样就不会读取错误

Uima Ruta 不一致词

java - 如何比较 Ruta 规则中两个不同注释的特征?

java - 在 UIMA Ruta Workbench 中添加 HeidelTime 作为分析引擎

java - 在 Eclipse 之外使用 UIMA Ruta : Problem with absolute paths/Compilation