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


Java XmiWriter类代码示例

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


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

示例1: main

import de.tudarmstadt.ukp.dkpro.core.io.xmi.XmiWriter; //导入依赖的package包/类
public static void main(String[] args) throws ResourceInitializationException, UIMAException, IOException {
	SimplePipeline.runPipeline(
			CollectionReaderFactory.createReaderDescription(TextgridTEIUrlReader.class,
					TextgridTEIUrlReader.PARAM_INPUT, "http://www.textgridrep.org/textgrid:tx4z.0",
					TextgridTEIUrlReader.PARAM_CLEANUP, true),
			AnalysisEngineFactory.createEngineDescription(XmiWriter.class, XmiWriter.PARAM_USE_DOCUMENT_ID, true,
					XmiWriter.PARAM_TARGET_LOCATION, "src/test/resources/SpeakerAssignmentRules/"));

	SimplePipeline.runPipeline(
			CollectionReaderFactory.createReaderDescription(TextgridTEIUrlReader.class,
					TextgridTEIUrlReader.PARAM_INPUT, "http://www.textgridrep.org/textgrid:w3zd.0",
					TextgridTEIUrlReader.PARAM_CLEANUP, true),
			AnalysisEngineFactory.createEngineDescription(XmiWriter.class, XmiWriter.PARAM_USE_DOCUMENT_ID, true,
					XmiWriter.PARAM_TARGET_LOCATION, "src/test/resources/SpeakerAssignmentRules/"));

	new File("src/test/resources/SpeakerAssignmentRules/typesystem.xml").delete();
}
 
开发者ID:quadrama,项目名称:DramaNLP,代码行数:18,代码来源:TestSpeakerAssignmentRules.java

示例2: train

import de.tudarmstadt.ukp.dkpro.core.io.xmi.XmiWriter; //导入依赖的package包/类
@Override
protected void train(CollectionReader collectionReader, File directory) throws Exception {
	String tmpView = "DP";

	AggregateBuilder b = new AggregateBuilder();

	b.add(AnalysisEngineFactory.createEngineDescription(PrepareClearTk.class, PrepareClearTk.PARAM_VIEW_NAME,
			tmpView, PrepareClearTk.PARAM_ANNOTATION_TYPE, DramatisPersonae.class,
			PrepareClearTk.PARAM_SUBANNOTATIONS, Arrays.asList(Figure.class)));
	b.add(AnalysisEngineFactory.createEngineDescription(BreakIteratorSegmenter.class), CAS.NAME_DEFAULT_SOFA,
			tmpView);
	b.add(AnalysisEngineFactory.createEngineDescription(ClearTkGenderAnnotator.class,
			DefaultDataWriterFactory.PARAM_DATA_WRITER_CLASS_NAME, LibSvmStringOutcomeDataWriter.class,
			DirectoryDataWriterFactory.PARAM_OUTPUT_DIRECTORY, directory), CAS.NAME_DEFAULT_SOFA, tmpView);
	b.add(AnalysisEngineFactory.createEngineDescription(XmiWriter.class, XmiWriter.PARAM_TARGET_LOCATION,
			"target/xmi"));

	SimplePipeline.runPipeline(collectionReader, b.createAggregate());

	Train.main(directory, new String[] { "-t", "0" });
}
 
开发者ID:quadrama,项目名称:DramaNLP,代码行数:22,代码来源:Evaluation.java

示例3: main

import de.tudarmstadt.ukp.dkpro.core.io.xmi.XmiWriter; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
	CollectionReaderDescription reader = CollectionReaderFactory.createReaderDescription(XmiReader.class,
			XmiReader.PARAM_SOURCE_LOCATION, "src/main/resources/gender/*/*.xmi", XmiReader.PARAM_LENIENT, true);

	String tmpView = "DP";

	AggregateBuilder b = new AggregateBuilder();

	b.add(AnalysisEngineFactory.createEngineDescription(PrepareClearTk.class, PrepareClearTk.PARAM_VIEW_NAME,
			tmpView, PrepareClearTk.PARAM_ANNOTATION_TYPE, DramatisPersonae.class,
			PrepareClearTk.PARAM_SUBANNOTATIONS, Arrays.asList(Figure.class)));
	b.add(AnalysisEngineFactory.createEngineDescription(BreakIteratorSegmenter.class), CAS.NAME_DEFAULT_SOFA,
			tmpView);
	b.add(AnalysisEngineFactory.createEngineDescription(ClearTkGenderAnnotator.class,
			DefaultDataWriterFactory.PARAM_DATA_WRITER_CLASS_NAME, LibSvmStringOutcomeDataWriter.class,
			DirectoryDataWriterFactory.PARAM_OUTPUT_DIRECTORY, "target/models"), CAS.NAME_DEFAULT_SOFA, tmpView);
	b.add(AnalysisEngineFactory.createEngineDescription(XmiWriter.class, XmiWriter.PARAM_TARGET_LOCATION,
			"target/xmi"));
	SimplePipeline.runPipeline(reader, b.createAggregateDescription());

	Train.main(new File("target/models"), new String[] { "-t", "0" });
}
 
开发者ID:quadrama,项目名称:DramaNLP,代码行数:23,代码来源:Training.java

示例4: testMapBackFeature

import de.tudarmstadt.ukp.dkpro.core.io.xmi.XmiWriter; //导入依赖的package包/类
@Test
public void testMapBackFeature() {
	try {
		SimplePipeline.runPipeline(view,
				AnalysisEngineFactory.createEngineDescription(XmiWriter.class, XmiWriter.PARAM_TARGET_LOCATION,
						"target/test", XmiWriter.PARAM_USE_DOCUMENT_ID, true),
				AnalysisEngineFactory.createEngineDescription(MapBackFeature.class,
						MapBackFeature.PARAM_ANNOTATION_TYPE, POS.class, MapBackFeature.PARAM_FEATURE_NAME,
						"PosValue", MapBackFeature.PARAM_VIEW_NAME, viewName));
	} catch (AnalysisEngineProcessException | ResourceInitializationException e) {
		e.printStackTrace();
	}
	POS pos = JCasUtil.selectByIndex(jcas, POS.class, 2);
	assertEquals("1", pos.getPosValue());

}
 
开发者ID:quadrama,项目名称:DramaNLP,代码行数:17,代码来源:TestMapBackFeature.java

示例5: main

import de.tudarmstadt.ukp.dkpro.core.io.xmi.XmiWriter; //导入依赖的package包/类
public static void main(String[] args) throws ResourceInitializationException, UIMAException, IOException {
	SimplePipeline.runPipeline(
			CollectionReaderFactory.createReaderDescription(TextgridTEIUrlReader.class,
					TextgridTEIUrlReader.PARAM_INPUT, "http://www.textgridrep.org/textgrid:rfxf.0",
					TextgridTEIUrlReader.PARAM_CLEANUP, true),
			AnalysisEngineFactory.createEngineDescription(XmiWriter.class, XmiWriter.PARAM_USE_DOCUMENT_ID, true,
					XmiWriter.PARAM_TARGET_LOCATION, "src/test/resources/FigureReferenceAnnotator/"));

	SimplePipeline.runPipeline(
			CollectionReaderFactory.createReaderDescription(TextgridTEIUrlReader.class,
					TextgridTEIUrlReader.PARAM_INPUT, "http://www.textgridrep.org/textgrid:w3zd.0",
					TextgridTEIUrlReader.PARAM_CLEANUP, true),
			AnalysisEngineFactory.createEngineDescription(XmiWriter.class, XmiWriter.PARAM_USE_DOCUMENT_ID, true,
					XmiWriter.PARAM_TARGET_LOCATION, "src/test/resources/FigureReferenceAnnotator/"));

	new File("src/test/resources/FigureReferenceAnnotator/typesystem.xml").delete();
}
 
开发者ID:quadrama,项目名称:DramaNLP,代码行数:18,代码来源:TestFigureReferenceAnnotator.java

示例6: testReaderFromURL

import de.tudarmstadt.ukp.dkpro.core.io.xmi.XmiWriter; //导入依赖的package包/类
@SuppressWarnings("resource")
// @Test
public void testReaderFromURL() throws UIMAException, IOException {
	CSVParser reader = new CSVParser(new FileReader(new File(csvFilename)),
			CSVFormat.TDF.withHeader((String) null));
	List<CSVRecord> records = reader.getRecords();

	description = CollectionReaderFactory.createReaderDescription(TextgridTEIUrlReader.class,
			TextgridTEIUrlReader.PARAM_INPUT, csvFilename, TextgridTEIUrlReader.PARAM_LANGUAGE, "de");
	JCasIterator iter = SimplePipeline
			.iteratePipeline(description, AnalysisEngineFactory.createEngineDescription(XmiWriter.class,
					XmiWriter.PARAM_TARGET_LOCATION, "target/doc/", XmiWriter.PARAM_USE_DOCUMENT_ID, true))
			.iterator();

	JCas jcas;
	CSVRecord gold;
	int recordIndex = 0;

	while (iter.hasNext()) {
		jcas = iter.next();
		gold = records.get(recordIndex++);
		checkSanity(jcas);
		checkGold(jcas, gold);
	}

}
 
开发者ID:quadrama,项目名称:DramaNLP,代码行数:27,代码来源:TestTextgridTEIFileReader.java

示例7: main

import de.tudarmstadt.ukp.dkpro.core.io.xmi.XmiWriter; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
	Options options = CliFactory.parseArguments(Options.class, args);

	// a reader that loads the URIs of the training files
	CollectionReaderDescription reader = CollectionReaderFactory.createReaderDescription(XmiReader.class,
			XmiReader.PARAM_SOURCE_LOCATION, options.getTrainDirectory() + "/*.xmi", XmiReader.PARAM_LENIENT, true);

	// run the pipeline over the training corpus
	SimplePipeline.runPipeline(reader,
			createEngineDescription(ContextWindowAnnotator.class, ContextWindowAnnotator.PARAM_BASE_ANNOTATION,
					FigureMention.class, ContextWindowAnnotator.PARAM_CONTEXT_CLASS, Speech.class,
					ContextWindowAnnotator.PARAM_TARGET_ANNOTATION, TrainingArea.class),
			createEngineDescription(ClearTkMentionAnnotator.class, CleartkSequenceAnnotator.PARAM_IS_TRAINING, true,
					DirectoryDataWriterFactory.PARAM_OUTPUT_DIRECTORY, options.getModelDirectory(),
					DefaultSequenceDataWriterFactory.PARAM_DATA_WRITER_CLASS_NAME,
					MalletCrfStringOutcomeDataWriter.class),
			createEngineDescription(XmiWriter.class, XmiWriter.PARAM_TARGET_LOCATION, "target/"));

	// train a Mallet CRF model on the training data
	Train.main(options.getModelDirectory());
}
 
开发者ID:quadrama,项目名称:DramaNLP,代码行数:22,代码来源:MentionDetectionTraining.java

示例8: export

import de.tudarmstadt.ukp.dkpro.core.io.xmi.XmiWriter; //导入依赖的package包/类
private static void export(File argumentsWithReasonsFile, File argumentsWithGistFile,
        File outputDir)
        throws Exception
{
    List<StandaloneArgument> arguments = ExportHelper.copyReasonAnnotationsWithGistOnly(
            argumentsWithReasonsFile, argumentsWithGistFile);

    String metaDataCSV = ExportHelper.exportMetaDataToCSV(arguments);
    FileUtils.write(new File(outputDir, "metadata.csv"), metaDataCSV, "utf-8");

    Frequency premisesFrequency = new Frequency();
    DescriptiveStatistics premisesStatistics = new DescriptiveStatistics();

    // and export them all as XMI files using standard DKPro pipeline
    for (StandaloneArgument argument : arguments) {
        JCas jCas = argument.getJCas();
        SimplePipeline.runPipeline(jCas, AnalysisEngineFactory.createEngineDescription(
                XmiWriter.class,
                XmiWriter.PARAM_TARGET_LOCATION, outputDir,
                XmiWriter.PARAM_USE_DOCUMENT_ID, true,
                XmiWriter.PARAM_OVERWRITE, true
        ));

        // count all premises
        int count = JCasUtil.select(jCas, Premise.class).size();
        premisesStatistics.addValue(count);
        premisesFrequency.addValue(count);
    }

    System.out.println("Premises total: " + premisesStatistics.getSum());
    System.out.println("Argument: " + arguments.size());
    System.out.println(premisesFrequency);
}
 
开发者ID:UKPLab,项目名称:argument-reasoning-comprehension-task,代码行数:34,代码来源:Step3dExportGistToXMIFiles.java

示例9: testPrepareClearTk

import de.tudarmstadt.ukp.dkpro.core.io.xmi.XmiWriter; //导入依赖的package包/类
@Test
public void testPrepareClearTk() throws ResourceInitializationException, UIMAException, IOException {
	SimplePipeline.runPipeline(
			CollectionReaderFactory.createReaderDescription(XmiReader.class, XmiReader.PARAM_SOURCE_LOCATION,
					"src/main/resources/gender/training/11d2m.0.xmi", XmiReader.PARAM_LENIENT, true),
			AnalysisEngineFactory.createEngineDescription(PrepareClearTk.class,
					PrepareClearTk.PARAM_ANNOTATION_TYPE, DramatisPersonae.class,
					PrepareClearTk.PARAM_SUBANNOTATIONS, Arrays.asList(Figure.class.getName()),
					PrepareClearTk.PARAM_VIEW_NAME, "DP"),
			AnalysisEngineFactory.createEngineDescription(XmiWriter.class, XmiWriter.PARAM_TARGET_LOCATION,
					"target/"));
}
 
开发者ID:quadrama,项目名称:DramaNLP,代码行数:13,代码来源:TestPrepareClearTk.java

示例10: setUp

import de.tudarmstadt.ukp.dkpro.core.io.xmi.XmiWriter; //导入依赖的package包/类
public static void setUp() throws Exception {
	SimplePipeline.runPipeline(
			CollectionReaderFactory.createReaderDescription(TextgridTEIUrlReader.class,
					TextgridTEIUrlReader.PARAM_INPUT, "src/test/resources/ReadDlinaMetadata/urls.txt"),
			AnalysisEngineFactory.createEngineDescription(XmiWriter.class, XmiWriter.PARAM_TARGET_LOCATION,
					"src/test/resources/ReadDlinaMetadata/xmi/"));
}
 
开发者ID:quadrama,项目名称:DramaNLP,代码行数:8,代码来源:TestReadDlinaMetadata.java

示例11: evaluateSpeakerAssignments

import de.tudarmstadt.ukp.dkpro.core.io.xmi.XmiWriter; //导入依赖的package包/类
@Test
public void evaluateSpeakerAssignments() throws Exception {
	JCasIterator iter = SimplePipeline
			.iteratePipeline(
					CollectionReaderFactory.createReaderDescription(XmiReader.class,
							XmiReader.PARAM_SOURCE_LOCATION, "src/test/resources/SpeakerIdentifier/tx4z.0.xmi",
							XmiReader.PARAM_LENIENT, true),
					createEngineDescription(FigureReferenceAnnotator.class),
					createEngineDescription(SpeakerIdentifier.class, SpeakerIdentifier.PARAM_CREATE_SPEAKER_FIGURE,
							false),
					createEngineDescription(XmiWriter.class, XmiWriter.PARAM_TARGET_LOCATION, "target/doc"))
			.iterator();
	StringBuilder b = new StringBuilder();
	CSVPrinter writer = new CSVPrinter(b, CSVFormat.TDF);
	SummaryStatistics types = new SummaryStatistics();
	SummaryStatistics tokens = new SummaryStatistics();
	while (iter.hasNext()) {
		JCas jcas = iter.next();
		int s = 0;
		int all = 0;
		Counter<String> unassigned = new Counter<String>();
		for (Speaker speaker : JCasUtil.select(jcas, Speaker.class)) {
			if (speaker.getFigure() == null) {
				unassigned.add(speaker.getCoveredText());
				s++;
			}
			all++;
		}
		types.addValue(unassigned.size());
		tokens.addValue(s);
		writer.printRecord(JCasUtil.selectSingle(jcas, Drama.class).getDocumentId(), s, unassigned.size(), all);
	}
	writer.printRecord("mean", tokens.getMean(), types.getMean());
	writer.printRecord("min", tokens.getMin(), types.getMin());
	writer.printRecord("max", tokens.getMax(), types.getMax());
	writer.close();
	System.out.println(b.toString());
}
 
开发者ID:quadrama,项目名称:DramaNLP,代码行数:39,代码来源:TestSpeakerIdentifier.java

示例12: main

import de.tudarmstadt.ukp.dkpro.core.io.xmi.XmiWriter; //导入依赖的package包/类
public static void main(String[] args) throws ResourceInitializationException, UIMAException, IOException {
	System.setProperty("java.util.logging.config.file", "src/main/resources/logging.properties");

	CollectionReaderDescription crd = CollectionReaderFactory.createReaderDescription(TextgridTEIUrlReader.class,
			TextgridTEIUrlReader.PARAM_INPUT, "src/main/resources");

	SimplePipeline.runPipeline(crd,
			/*
			 * Do segmentation.
			 */
			D.getWrappedSegmenterDescription(LanguageToolSegmenter.class),
			createEngineDescription(FigureReferenceAnnotator.class),
			createEngineDescription(SpeakerIdentifier.class, SpeakerIdentifier.PARAM_CREATE_SPEAKER_FIGURE, true),
			/*
			 * standard NLP components. This works because dkpro only sees
			 * tokens and sentences. The segmenter creates those only for
			 * the figure speech (and not for stage directions)
			 */
			createEngineDescription(StanfordPosTagger.class),
			createEngineDescription(StanfordNamedEntityRecognizer.class),
			createEngineDescription(FigureMentionDetection.class),
			/*
			 * Extract copresence network
			 */
			createEngineDescription(NetworkExtractor.class),
			/*
			 * extract mention network
			 */
			createEngineDescription(NetworkExtractor.class, NetworkExtractor.PARAM_VIEW_NAME, "MentionNetwork",
					NetworkExtractor.PARAM_NETWORK_TYPE, "MentionNetwork"),
			/*
			 * print xmi
			 */
			createEngineDescription(XmiWriter.class, XmiWriter.PARAM_TARGET_LOCATION, "target/xmi/"));
}
 
开发者ID:quadrama,项目名称:DramaNLP,代码行数:36,代码来源:Process.java

示例13: testReader2

import de.tudarmstadt.ukp.dkpro.core.io.xmi.XmiWriter; //导入依赖的package包/类
public void testReader2() throws ResourceInitializationException {
	description = CollectionReaderFactory.createReaderDescription(GutenbergDEReader.class,
			GutenbergDEReader.PARAM_INPUT, "src/test/resources/test2");
	JCasIterator iter = SimplePipeline.iteratePipeline(description, AnalysisEngineFactory
			.createEngineDescription(XmiWriter.class, XmiWriter.PARAM_TARGET_LOCATION, "target/doc")).iterator();
	JCas jcas;
	Scene scene;

	jcas = iter.next();

	// sanity check
	// 2.xml

	// TODO: Currently, we don'T detect scenes and acts correctly
	assertEquals("2", JCasUtil.selectSingle(jcas, Drama.class).getDocumentId());
	assertTrue(JCasUtil.exists(jcas, Drama.class));
	// assertTrue(JCasUtil.exists(jcas, Act.class));
	// assertFalse(JCasUtil.exists(jcas, Scene.class));
	assertTrue(JCasUtil.exists(jcas, Speaker.class));
	assertTrue(JCasUtil.exists(jcas, DramatisPersonae.class));
	assertTrue(JCasUtil.exists(jcas, FrontMatter.class));
	assertTrue(JCasUtil.exists(jcas, MainMatter.class));

	// assertEquals(3, JCasUtil.select(jcas, Act.class).size());

	assertFalse(iter.hasNext());
}
 
开发者ID:quadrama,项目名称:DramaNLP,代码行数:28,代码来源:TestGutenbergDEReader.java

示例14: setUp

import de.tudarmstadt.ukp.dkpro.core.io.xmi.XmiWriter; //导入依赖的package包/类
@BeforeClass
public static void setUp() throws ResourceInitializationException {
	description = CollectionReaderFactory.createReaderDescription(TextgridTEIUrlReader.class,
			TextgridTEIUrlReader.PARAM_INPUT, "src/test/resources/textgridFiles/r134.0.xml");
	AggregateBuilder b = new AggregateBuilder();
	if (TestGenerics.debug)
		b.add(AnalysisEngineFactory.createEngineDescription(XmiWriter.class, XmiWriter.PARAM_TARGET_LOCATION,
				"target/doc"));
	jcas = SimplePipeline.iteratePipeline(description, b.createAggregateDescription()).iterator().next();
}
 
开发者ID:quadrama,项目名称:DramaNLP,代码行数:11,代码来源:TestReaderR1340.java

示例15: setUp

import de.tudarmstadt.ukp.dkpro.core.io.xmi.XmiWriter; //导入依赖的package包/类
@BeforeClass
public static void setUp() throws ResourceInitializationException {
	description = CollectionReaderFactory.createReaderDescription(CoreTEIUrlReader.class,
			CoreTEIUrlReader.PARAM_INPUT, "src/test/resources/es/Calderon.xml", CoreTEIUrlReader.PARAM_LANGUAGE,
			"es");
	AggregateBuilder b = new AggregateBuilder();
	if (TestGenerics.debug)
		b.add(AnalysisEngineFactory.createEngineDescription(XmiWriter.class, XmiWriter.PARAM_TARGET_LOCATION,
				"target/doc"));
	jcas = SimplePipeline.iteratePipeline(description, b.createAggregateDescription()).iterator().next();
}
 
开发者ID:quadrama,项目名称:DramaNLP,代码行数:12,代码来源:TestCoreTEIUrlReader.java


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