热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.apache.uima.jcas.tcas.DocumentAnnotation.getDocType()方法的使用及代码示例

本文整理了Java中org.apache.uima.jcas.tcas.DocumentAnnotation.getDocType()方法的一些代码示例,展示了

本文整理了Java中org.apache.uima.jcas.tcas.DocumentAnnotation.getDocType()方法的一些代码示例,展示了DocumentAnnotation.getDocType()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DocumentAnnotation.getDocType()方法的具体详情如下:
包路径:org.apache.uima.jcas.tcas.DocumentAnnotation
类名称:DocumentAnnotation
方法名:getDocType

DocumentAnnotation.getDocType介绍

[英]getter for docType - gets The document type
[中]docType的getter-获取文档类型

代码示例

代码示例来源:origin: dstl/baleen

private File getDestinationFolder(DocumentAnnotation da) {
File dest = new File(destination);
if (splitByType) {
String type = da.getDocType();
if (!Strings.isNullOrEmpty(type)) {
dest = new File(dest, type);
}
}
return dest;
}
}

代码示例来源:origin: dstl/baleen

private void addDocumentAnnotationToProperties(
final Map properties, final DocumentAnnotation da) {
properties.put(AnalysisConstants.DOCUMENT_TYPE, da.getDocType());
properties.put(AnalysisConstants.CAVEATS, UimaTypesUtils.toList(da.getDocumentCaveats()));
properties.put(AnalysisConstants.CLASSIFICATION, da.getDocumentClassification());
properties.put(
AnalysisConstants.RELEASABILITY, UimaTypesUtils.toList(da.getDocumentReleasability()));
properties.put(AnalysisConstants.LANGUAGE, da.getLanguage());
properties.put(AnalysisConstants.HASH, da.getHash());
properties.put(AnalysisConstants.SOURCE, da.getSourceUri());
properties.put(AnalysisConstants.TIMESTAMP, new Date(da.getTimestamp()));
}

代码示例来源:origin: dstl/baleen

private Map serialiseDocumentAnnotation(final DocumentAnnotation da) {
final Map map = new HashMap<>();
map.put(JsonJCas.DA_DOCUMENT_TYPE, da.getDocType());
map.put(JsonJCas.DA_LANGUAGE, da.getLanguage());
map.put(JsonJCas.DA_SOURCE_URI, da.getSourceUri());
map.put(JsonJCas.DA_CLASSIFICATION, da.getDocumentClassification());
final String[] caveats =
da.getDocumentCaveats() != null ? da.getDocumentCaveats().toArray() : new String[0];
map.put(JsonJCas.DA_CAVEATS, caveats);
final String[] rels =
da.getDocumentReleasability() != null
? da.getDocumentReleasability().toArray()
: new String[0];
map.put(JsonJCas.DA_RELEASABILITY, rels);
return map;
}

代码示例来源:origin: dstl/baleen

@Test
public void testBaseDirectoryOneLayers() throws Exception {
DocumentAnnotation da = getDocumentAnnotation();
da.setSourceUri(tmp.getAbsolutePath());
processJCas(BASE_DIRECTORY, parentDir.getAbsolutePath());
String relative =
tmp.getAbsolutePath()
.substring(
parentDir.getAbsolutePath().length() + 1,
tmp.getAbsolutePath().length() - tmp.getName().length() - 1);
assertEquals(relative, da.getDocType());
}

代码示例来源:origin: dstl/baleen

@Test
public void testBaseDirectoryTwoLayers() throws Exception {
DocumentAnnotation da = getDocumentAnnotation();
da.setSourceUri(tmp.getAbsolutePath());
processJCas(BASE_DIRECTORY, topDir.getAbsolutePath());
String relative =
tmp.getAbsolutePath()
.substring(
topDir.getAbsolutePath().length() + 1,
tmp.getAbsolutePath().length() - tmp.getName().length() - 1);
assertEquals(relative, da.getDocType());
}
}

代码示例来源:origin: dstl/baleen

@Test
public void testBadParameters() throws Exception {
DocumentAnnotation da = getDocumentAnnotation();
da.setSourceUri(tmp.getAbsolutePath());
processJCas(BASE_DIRECTORY, null);
String relative =
tmp.getAbsolutePath()
.substring(
parentDir.getAbsolutePath().length() + 1,
tmp.getAbsolutePath().length() - tmp.getName().length() - 1);
assertNotEquals(relative, da.getDocType());
processJCas(BASE_DIRECTORY, "/not/the/path");
assertNotEquals(relative, da.getDocType());
}

代码示例来源:origin: dstl/baleen

@Test
public void testThrehold() throws Exception {
jCas.setDocumentText("This text isn't going to score above the threshold.");
processJCas(
DocumentType.PARAM_MODEL,
getClass().getResource(DOCUMENTTYPE_BIN).getPath(),
DocumentType.PARAM_CONFIDENCE_THRESHOLD,
"0.99"); // Model trained on IOM and BBC reporting, and is OFFICIAL
DocumentAnnotation da = getDocumentAnnotation();
assertEquals(null, da.getDocType());
}
}

代码示例来源:origin: dstl/baleen

@Test
public void test() throws Exception {
try {
DocumentAnnotation da = getDocumentAnnotation();
da.setSourceUri(tmp.getAbsolutePath());
processJCas();
// Remove slash (requried for unix paths)
String absolutePath = childDir.getAbsolutePath();
if (absolutePath.startsWith(File.separator)) {
absolutePath = absolutePath.substring(1);
}
assertEquals(absolutePath, da.getDocType());
} finally {
tmp.delete();
}
}

代码示例来源:origin: dstl/baleen

@Test
public void testBaseDirectory() throws Exception {
DocumentAnnotation da = getDocumentAnnotation();
da.setSourceUri(tmp.getAbsolutePath());
processJCas(BASE_DIRECTORY, childDir.getAbsolutePath());
assertEquals("", da.getDocType());
}

代码示例来源:origin: dstl/baleen

@Test
public void testType() throws AnalysisEngineProcessException, ResourceInitializationException {
processJCas(DocumentTypeByParameter.PARAM_TYPE, "test");
assertEquals("test", getDocumentAnnotation().getDocType());
}

代码示例来源:origin: dstl/baleen

@Test
public void testNullType()
throws AnalysisEngineProcessException, ResourceInitializationException {
processJCas(DocumentTypeByParameter.PARAM_TYPE, null);
assertNull(getDocumentAnnotation().getDocType());
}

代码示例来源:origin: dstl/baleen

@Test
public void testEmptyType()
throws AnalysisEngineProcessException, ResourceInitializationException {
processJCas(DocumentTypeByParameter.PARAM_TYPE, "");
assertNull(getDocumentAnnotation().getDocType());
}
}

代码示例来源:origin: dstl/baleen

@Test
public void testPatternCaseSensitiveFalse() throws Exception {
DocumentAnnotation da = getDocumentAnnotation();
da.setSourceUri("20170127-Test_Document.docx");
processJCas(
DocumentTypeByFilename.PARAM_PATTERN,
"\\d{8}-([a-z]).*",
DocumentTypeByFilename.PARAM_DEFAULT,
"unknown");
assertEquals("t", da.getDocType());
}

代码示例来源:origin: dstl/baleen

@Test
public void testDefault() throws Exception {
DocumentAnnotation da = getDocumentAnnotation();
da.setSourceUri("20170127-Test_Document.docx");
processJCas();
assertEquals("docx", da.getDocType());
}

代码示例来源:origin: dstl/baleen

@Test
public void testPrefix() throws Exception {
DocumentAnnotation da = getDocumentAnnotation();
da.setSourceUri("20170127-Test_Document.docx");
processJCas(DocumentTypeByFilename.PARAM_PREFIX, "filetype_");
assertEquals("filetype_docx", da.getDocType());
}

代码示例来源:origin: dstl/baleen

@Test
public void testPattern() throws Exception {
DocumentAnnotation da = getDocumentAnnotation();
da.setSourceUri("20170127-Test_Document.docx");
processJCas(DocumentTypeByFilename.PARAM_PATTERN, "(\\d{4}).*");
assertEquals("2017", da.getDocType());
}

代码示例来源:origin: dstl/baleen

@Test
public void testLowerCase() throws Exception {
DocumentAnnotation da = getDocumentAnnotation();
da.setSourceUri("20170127-Test_Document.docx");
processJCas(
DocumentTypeByFilename.PARAM_PATTERN,
"\\d{8}-([a-z]).*",
DocumentTypeByFilename.PARAM_LOWER_CASE,
false);
assertEquals("T", da.getDocType());
}
}

代码示例来源:origin: dstl/baleen

@Test
public void testGroup() throws Exception {
DocumentAnnotation da = getDocumentAnnotation();
da.setSourceUri("20170127-Test_Document.docx");
processJCas(
DocumentTypeByFilename.PARAM_PATTERN,
"(\\d{4})(\\d{2})(\\d{2}).*",
DocumentTypeByFilename.PARAM_GROUP,
2);
assertEquals("01", da.getDocType());
}

代码示例来源:origin: dstl/baleen

@Test
public void testPatternNoMatch() throws Exception {
DocumentAnnotation da = getDocumentAnnotation();
da.setSourceUri("20170127-Test_Document.docx");
processJCas(
DocumentTypeByFilename.PARAM_PATTERN,
"([a-z]{2}).*",
DocumentTypeByFilename.PARAM_DEFAULT,
"unknown");
assertEquals("unknown", da.getDocType());
}

代码示例来源:origin: dstl/baleen

@Test
public void testPatternCaseSensitiveTrue() throws Exception {
DocumentAnnotation da = getDocumentAnnotation();
da.setSourceUri("20170127-Test_Document.docx");
processJCas(
DocumentTypeByFilename.PARAM_PATTERN,
"\\d{8}-([a-z]).*",
DocumentTypeByFilename.PARAM_DEFAULT,
"unknown",
DocumentTypeByFilename.PARAM_CASE_SENSITIVE,
true);
assertEquals("unknown", da.getDocType());
}

推荐阅读
  • Spring源码解密之默认标签的解析方式分析
    本文分析了Spring源码解密中默认标签的解析方式。通过对命名空间的判断,区分默认命名空间和自定义命名空间,并采用不同的解析方式。其中,bean标签的解析最为复杂和重要。 ... [详细]
  • PHP图片截取方法及应用实例
    本文介绍了使用PHP动态切割JPEG图片的方法,并提供了应用实例,包括截取视频图、提取文章内容中的图片地址、裁切图片等问题。详细介绍了相关的PHP函数和参数的使用,以及图片切割的具体步骤。同时,还提供了一些注意事项和优化建议。通过本文的学习,读者可以掌握PHP图片截取的技巧,实现自己的需求。 ... [详细]
  • 向QTextEdit拖放文件的方法及实现步骤
    本文介绍了在使用QTextEdit时如何实现拖放文件的功能,包括相关的方法和实现步骤。通过重写dragEnterEvent和dropEvent函数,并结合QMimeData和QUrl等类,可以轻松实现向QTextEdit拖放文件的功能。详细的代码实现和说明可以参考本文提供的示例代码。 ... [详细]
  • Android JSON基础,音视频开发进阶指南目录
    Array里面的对象数据是有序的,json字符串最外层是方括号的,方括号:[]解析jsonArray代码try{json字符串最外层是 ... [详细]
  • 标题: ... [详细]
  • 本文介绍了在处理不规则数据时如何使用Python自动提取文本中的时间日期,包括使用dateutil.parser模块统一日期字符串格式和使用datefinder模块提取日期。同时,还介绍了一段使用正则表达式的代码,可以支持中文日期和一些特殊的时间识别,例如'2012年12月12日'、'3小时前'、'在2012/12/13哈哈'等。 ... [详细]
  • 如何查询zone下的表的信息
    本文介绍了如何通过TcaplusDB知识库查询zone下的表的信息。包括请求地址、GET请求参数说明、返回参数说明等内容。通过curl方法发起请求,并提供了请求示例。 ... [详细]
  • 本文介绍了如何使用JSONObiect和Gson相关方法实现json数据与kotlin对象的相互转换。首先解释了JSON的概念和数据格式,然后详细介绍了相关API,包括JSONObject和Gson的使用方法。接着讲解了如何将json格式的字符串转换为kotlin对象或List,以及如何将kotlin对象转换为json字符串。最后提到了使用Map封装json对象的特殊情况。文章还对JSON和XML进行了比较,指出了JSON的优势和缺点。 ... [详细]
  • python3 nmap函数简介及使用方法
    本文介绍了python3 nmap函数的简介及使用方法,python-nmap是一个使用nmap进行端口扫描的python库,它可以生成nmap扫描报告,并帮助系统管理员进行自动化扫描任务和生成报告。同时,它也支持nmap脚本输出。文章详细介绍了python-nmap的几个py文件的功能和用途,包括__init__.py、nmap.py和test.py。__init__.py主要导入基本信息,nmap.py用于调用nmap的功能进行扫描,test.py用于测试是否可以利用nmap的扫描功能。 ... [详细]
  • Apache Shiro 身份验证绕过漏洞 (CVE202011989) 详细解析及防范措施
    本文详细解析了Apache Shiro 身份验证绕过漏洞 (CVE202011989) 的原理和影响,并提供了相应的防范措施。Apache Shiro 是一个强大且易用的Java安全框架,常用于执行身份验证、授权、密码和会话管理。在Apache Shiro 1.5.3之前的版本中,与Spring控制器一起使用时,存在特制请求可能导致身份验证绕过的漏洞。本文还介绍了该漏洞的具体细节,并给出了防范该漏洞的建议措施。 ... [详细]
  • 1Lock与ReadWriteLock1.1LockpublicinterfaceLock{voidlock();voidlockInterruptibl ... [详细]
  • 本文介绍了利用ARMA模型对平稳非白噪声序列进行建模的步骤及代码实现。首先对观察值序列进行样本自相关系数和样本偏自相关系数的计算,然后根据这些系数的性质选择适当的ARMA模型进行拟合,并估计模型中的位置参数。接着进行模型的有效性检验,如果不通过则重新选择模型再拟合,如果通过则进行模型优化。最后利用拟合模型预测序列的未来走势。文章还介绍了绘制时序图、平稳性检验、白噪声检验、确定ARMA阶数和预测未来走势的代码实现。 ... [详细]
  • 颜色迁移(reinhard VS welsh)
    不要谈什么天分,运气,你需要的是一个截稿日,以及一个不交稿就能打爆你狗头的人,然后你就会被自己的才华吓到。------ ... [详细]
  • 如何使用Python从工程图图像中提取底部的方法?
    本文介绍了使用Python从工程图图像中提取底部的方法。首先将输入图片转换为灰度图像,并进行高斯模糊和阈值处理。然后通过填充潜在的轮廓以及使用轮廓逼近和矩形核进行过滤,去除非矩形轮廓。最后通过查找轮廓并使用轮廓近似、宽高比和轮廓区域进行过滤,隔离所需的底部轮廓,并使用Numpy切片提取底部模板部分。 ... [详细]
  • 本文由编程笔记#小编为大家整理,主要介绍了源码分析--ConcurrentHashMap与HashTable(JDK1.8)相关的知识,希望对你有一定的参考价值。  Concu ... [详细]
author-avatar
张。、
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有