本文整理汇总了Java中org.apache.uima.util.CasToInlineXml类的典型用法代码示例。如果您正苦于以下问题:Java CasToInlineXml类的具体用法?Java CasToInlineXml怎么用?Java CasToInlineXml使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CasToInlineXml类属于org.apache.uima.util包,在下文中一共展示了CasToInlineXml类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import org.apache.uima.util.CasToInlineXml; //导入依赖的package包/类
/**
* Get the parameter values
*/
public void initialize(UimaContext context) throws ResourceInitializationException {
// super
super.initialize(context);
// current AE parameter
//mDocNum = 0;
try {
mOutputDir = new File(((String) context.getConfigParameterValue(PARAM_OUTPUTDIR)).trim());
if (!mOutputDir.exists()) {
mOutputDir.mkdirs();
}
cas2xml = new CasToInlineXml();
} catch (Exception e) {
throw new ResourceInitializationException(e);
}
fileExtensionName = ((String) context.getConfigParameterValue(PARAM_FILEEXT));
}
示例2: initialize
import org.apache.uima.util.CasToInlineXml; //导入依赖的package包/类
public void initialize() throws ResourceInitializationException {
mDocNum = 0;
mOutputDir = new File(((String) getConfigParameterValue(PARAM_OUTPUTDIR)).trim());
if (!mOutputDir.exists()) {
mOutputDir.mkdirs();
}
cas2xml = new CasToInlineXml();
}
示例3: createHtml
import org.apache.uima.util.CasToInlineXml; //导入依赖的package包/类
public void createHtml(JCas jCas, TypeSystem typeSystem, File styleMapFile,
File outputDirectory) throws IOException {
try {
FileUtils.forceMkdir(outputDirectory);
generator.setOutputDirectory(outputDirectory);
CAS cas = jCas.getCas();
// get the specified view
cas = cas.getView(this.defaultCasViewName);
CAS defaultView = cas.getView(CAS.NAME_DEFAULT_SOFA);
if (defaultView.getDocumentText() == null) {
System.err
.println("The HTML and XML Viewers can only view the default text document, which was not found in this CAS.");
return;
}
// generate inline XML
File inlineXmlFile = new File(outputDirectory, "inline.xml");
String xmlAnnotations = new CasToInlineXml()
.generateXML(defaultView);
FileOutputStream outStream = new FileOutputStream(inlineXmlFile);
outStream.write(xmlAnnotations.getBytes("UTF-8"));
outStream.close();
// generate HTML view
// if (!styleMapFile.exists()) {
// AnalysisEngineDescription aed = null;
//
// annotationViewGenerator.autoGenerateStyleMapFile(
// aed.getAnalysisEngineMetaData(), styleMapFile);
// }
generator.processStyleMap(styleMapFile);
generator.processDocument(inlineXmlFile);
// File genFile = new File(viewerDirectory, "index.html");
} catch (Exception ex) {
throw new IOException("cannot create html annotationviewer", ex);
}
}