java - 获取注释文本
问题描述
我正在研究 GATE embeded 中的信息提取。我已尝试使用以下代码从注释中获取文本:
AnnotationSet annotationSet = doc.getAnnotations().get("Person");
DocumentContent personStr = annotationSet .getContent();
但是 get.Content 无法在注释类型中工作。那么我们如何才能得到带注释的文本。提前致谢
解决方案
@ashingel 的回答是正确的,只是添加代码片段,如何使用它:
AnnotationSet annotationSet = doc.getAnnotations().get("Person");
for (Annotation annotation : annotationSet) {
String personStr = gate.Utils.stringFor(doc, annotation);
System.out.println(personStr);
}
推荐阅读
- java - 如何在我的 Android 应用中实现 7 天免费试用期的年度订阅的“帐户保留”状态?
- sql - Vb.net 函数不返回 SQL Server 存储过程结果
- python - 将 numpy 数组转换为 html img 标签的 src 可读的字节串
- django - 允许将 django 模型字段修改为某些用户
- javascript - 有没有办法通过 ReactJs 中的动态操作调用来更新 props 变量?
- python-3.x - 带有列表的 Python 平分行为
- c++ - c++ 方法从另一个模板类和命名空间泄漏
- python - findAndModify 不使用索引搜索
- swift - CustomVideoCompositorClass - 绘制时出现 CGContext 错误(CGImage,CGRect)
- laravel - Laravel:选择一对多关系中的第一条记录