我有一个文档,经过一些注释后,我正在使用 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/