当前位置: 首页>>代码示例>>Java>>正文


Java DocumentStaxUtils类代码示例

本文整理汇总了Java中gate.corpora.DocumentStaxUtils的典型用法代码示例。如果您正苦于以下问题:Java DocumentStaxUtils类的具体用法?Java DocumentStaxUtils怎么用?Java DocumentStaxUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DocumentStaxUtils类属于gate.corpora包,在下文中一共展示了DocumentStaxUtils类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: annotateDocument

import gate.corpora.DocumentStaxUtils; //导入依赖的package包/类
/**
 *
 * @param documentToAnnotate the document to be annotated
 * @param saveLocation the location the annotated document will be saved.
 * @param transducer the transducer that will be used.
 * @throws GateException
 * @throws IOException
 * @throws XMLStreamException
 */
public void annotateDocument(final File documentToAnnotate, String saveLocation, Transducer transducer)
        throws GateException, IOException, XMLStreamException {
    Document d = loadDocument(documentToAnnotate);

    Corpus corpus = Factory.newCorpus("JAPE corpus");
    transducer.setCorpus(corpus);
    transducer.setDocument(d);
    corpus.add(d);
    transducer.execute();
    String pathname = saveLocation + "/" + documentToAnnotate.getName() + ".xml";
    DocumentStaxUtils.writeDocument(d, new File(pathname));
    corpus.cleanup();
    d.cleanup();
    transducer.cleanup();
}
 
开发者ID:naditina,项目名称:gate-semano,代码行数:25,代码来源:JAPEAnnotator.java

示例2: export

import gate.corpora.DocumentStaxUtils; //导入依赖的package包/类
@Override
public void export(Document doc, OutputStream out, FeatureMap options)
        throws IOException {
  try {
    DocumentStaxUtils.writeDocument(doc, out, "");
  } catch(XMLStreamException e) {
    throw new IOException(e);
  }
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:10,代码来源:GateXMLExporter.java

示例3: writeTo

import gate.corpora.DocumentStaxUtils; //导入依赖的package包/类
@Override
public void writeTo(OutputStream out) throws IOException {
  XMLStreamWriter xsw = new StAXDocumentSerializer(out);
  try {
    try {
      xsw.writeStartDocument();
      DocumentStaxUtils.writeDocument(document, xsw, "");
    } finally {
      xsw.close();
    }
  } catch(XMLStreamException xse) {
    throw new IOException(xse);
  }
}
 
开发者ID:GateNLP,项目名称:cloud-client,代码行数:15,代码来源:FINFWritable.java

示例4: annotateDocumentWithCorpusController

import gate.corpora.DocumentStaxUtils; //导入依赖的package包/类
public void annotateDocumentWithCorpusController(final File documentToAnnotate, String saveLocation, CorpusController controller)
        throws GateException, IOException, XMLStreamException {
    Document d = loadDocument(documentToAnnotate);
    Corpus corpus = annotateDocument(controller, d);
    String pathname = saveLocation + "/" + documentToAnnotate.getName() + ".xml";
    DocumentStaxUtils.writeDocument(d, new File(pathname));
    corpus.cleanup();
    d.cleanup();
    controller.cleanup();
}
 
开发者ID:naditina,项目名称:gate-semano,代码行数:11,代码来源:JAPEAnnotator.java


注:本文中的gate.corpora.DocumentStaxUtils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。