热门标签 | 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());
}

推荐阅读
  • 本文详细介绍了Java中org.neo4j.helpers.collection.Iterators.single()方法的功能、使用场景及代码示例,帮助开发者更好地理解和应用该方法。 ... [详细]
  • Explore how Matterverse is redefining the metaverse experience, creating immersive and meaningful virtual environments that foster genuine connections and economic opportunities. ... [详细]
  • Explore a common issue encountered when implementing an OAuth 1.0a API, specifically the inability to encode null objects and how to resolve it. ... [详细]
  • 1:有如下一段程序:packagea.b.c;publicclassTest{privatestaticinti0;publicintgetNext(){return ... [详细]
  • 1.如何在运行状态查看源代码?查看函数的源代码,我们通常会使用IDE来完成。比如在PyCharm中,你可以Ctrl+鼠标点击进入函数的源代码。那如果没有IDE呢?当我们想使用一个函 ... [详细]
  • 本文详细介绍了Java中org.eclipse.ui.forms.widgets.ExpandableComposite类的addExpansionListener()方法,并提供了多个实际代码示例,帮助开发者更好地理解和使用该方法。这些示例来源于多个知名开源项目,具有很高的参考价值。 ... [详细]
  • 本文详细介绍了Java编程语言中的核心概念和常见面试问题,包括集合类、数据结构、线程处理、Java虚拟机(JVM)、HTTP协议以及Git操作等方面的内容。通过深入分析每个主题,帮助读者更好地理解Java的关键特性和最佳实践。 ... [详细]
  • 本文详细介绍了Java中org.w3c.dom.Text类的splitText()方法,通过多个代码示例展示了其实际应用。该方法用于将文本节点在指定位置拆分为两个节点,并保持在文档树中。 ... [详细]
  • 本文介绍如何使用阿里云的fastjson库解析包含时间戳、IP地址和参数等信息的JSON格式文本,并进行数据处理和保存。 ... [详细]
  • 本文详细介绍了 com.facebook.drawee.view.SimpleDraweeView 中的 setScaleType 方法,提供了多个实际代码示例,并解释了其在不同场景下的应用。 ... [详细]
  • 毕业设计:基于机器学习与深度学习的垃圾邮件(短信)分类算法实现
    本文详细介绍了如何使用机器学习和深度学习技术对垃圾邮件和短信进行分类。内容涵盖从数据集介绍、预处理、特征提取到模型训练与评估的完整流程,并提供了具体的代码示例和实验结果。 ... [详细]
  • 优化ListView性能
    本文深入探讨了如何通过多种技术手段优化ListView的性能,包括视图复用、ViewHolder模式、分批加载数据、图片优化及内存管理等。这些方法能够显著提升应用的响应速度和用户体验。 ... [详细]
  • 本文详细介绍了 GWT 中 PopupPanel 类的 onKeyDownPreview 方法,提供了多个代码示例及应用场景,帮助开发者更好地理解和使用该方法。 ... [详细]
  • 本文详细记录了在银河麒麟操作系统和龙芯架构上使用 Qt 5.15.2 进行项目打包时遇到的问题及解决方案,特别关注于 linuxdeployqt 工具的应用。 ... [详细]
  • 本文详细探讨了JDBC(Java数据库连接)的内部机制,重点分析其作为服务提供者接口(SPI)框架的应用。通过类图和代码示例,展示了JDBC如何注册驱动程序、建立数据库连接以及执行SQL查询的过程。 ... [详细]
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社区 版权所有