本文整理汇总了Java中org.apache.uima.fit.pipeline.SimplePipeline.runPipeline方法的典型用法代码示例。如果您正苦于以下问题:Java SimplePipeline.runPipeline方法的具体用法?Java SimplePipeline.runPipeline怎么用?Java SimplePipeline.runPipeline使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.uima.fit.pipeline.SimplePipeline
的用法示例。
在下文中一共展示了SimplePipeline.runPipeline方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.apache.uima.fit.pipeline.SimplePipeline; //导入方法依赖的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();
}
示例2: main
import org.apache.uima.fit.pipeline.SimplePipeline; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
// TypeSystemDescription tsd = TypeSystemDescriptionFactory.createTypeSystemDescriptionFromPath("../desc/TypeSystem.xml");
JCas jcas = JCasFactory.createJCas();
jcas.setDocumentText("Patient is a 30-year-old man named Leroy Butler from Green Bay, WI.");
AnalysisEngineDescription aed = AnalysisEngineFactory.createEngineDescription(MistAnalysisEngine.class,
MistAnalysisEngine.PARAM_MODEL_PATH,
"SHARP/model/model");
SimplePipeline.runPipeline(jcas, aed);
for(Annotation annot : JCasUtil.select(jcas, Annotation.class)){
System.out.println("Found annotation: " + annot.getCoveredText());
}
JCas deidView = jcas.getView(MistAnalysisEngine.DEID_VIEW_NAME);
System.out.println("Deidentified version:");
System.out.println(deidView.getDocumentText());
}
示例3: exportToHTML
import org.apache.uima.fit.pipeline.SimplePipeline; //导入方法依赖的package包/类
public static void exportToHTML(File inputFile, File outputFile)
throws Exception
{
File intermediateXMIsFile = File.createTempFile("temp", ".xmi.tar.gz");
SingleXMLToXMIExporter.exportToXMIs(inputFile, intermediateXMIsFile);
SimplePipeline.runPipeline(
CollectionReaderFactory.createReaderDescription(
CompressedXmiReader.class,
CompressedXmiReader.PARAM_SOURCE_LOCATION, intermediateXMIsFile
),
AnalysisEngineFactory.createEngineDescription(ArgumentsToHTMLExporter.class,
ArgumentsToHTMLExporter.PARAM_OUTPUT_FILE, outputFile),
AnalysisEngineFactory.createEngineDescription(
ArgumentDumpWriter.class
)
);
Files.delete(intermediateXMIsFile.toPath());
}
开发者ID:UKPLab,项目名称:argument-reasoning-comprehension-task,代码行数:22,代码来源:Step09AnnotatedDataHTMLExporter.java
示例4: main
import org.apache.uima.fit.pipeline.SimplePipeline; //导入方法依赖的package包/类
public static void main(String[] args)
throws Exception
{
String in = "/tmp/temp-in";
String out = "/tmp/out2.tar.gz";
// test it
SimplePipeline.runPipeline(CollectionReaderFactory.createReaderDescription(
XmiReader.class,
XmiReader.PARAM_SOURCE_LOCATION, in,
XmiReader.PARAM_PATTERNS, XmiReader.INCLUDE_PREFIX + "*.xmi"
),
AnalysisEngineFactory.createEngineDescription(
NoOpAnnotator.class
),
AnalysisEngineFactory.createEngineDescription(
CompressedXmiWriter.class,
CompressedXmiWriter.PARAM_OUTPUT_FILE, out
)
);
}
示例5: main
import org.apache.uima.fit.pipeline.SimplePipeline; //导入方法依赖的package包/类
public static void main(String[] args) throws UIMAException, IOException {
Logger.getRootLogger().setLevel(Level.INFO);
if (args.length > 0)
textFolder = args[0];
// read preprocessed documents
CollectionReaderDescription reader = CollectionReaderFactory.createReaderDescription(BinaryCasReader.class,
BinaryCasReader.PARAM_SOURCE_LOCATION, textFolder, BinaryCasReader.PARAM_PATTERNS, textPattern,
BinaryCasReader.PARAM_LANGUAGE, "en");
// find Open IE tuples
AnalysisEngineDescription openIE = AnalysisEngineFactory.createEngineDescription(OpenIEAnnotator.class);
// write annotated data to file
AnalysisEngineDescription writer = AnalysisEngineFactory.createEngineDescription(BinaryCasWriter.class,
BinaryCasWriter.PARAM_TARGET_LOCATION, textFolder, BinaryCasWriter.PARAM_STRIP_EXTENSION, true,
BinaryCasWriter.PARAM_FILENAME_EXTENSION, ".oie.bin6", BinaryCasWriter.PARAM_OVERWRITE, true);
// run pipeline
SimplePipeline.runPipeline(reader, openIE, writer);
}
示例6: main
import org.apache.uima.fit.pipeline.SimplePipeline; //导入方法依赖的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();
}
示例7: run
import org.apache.uima.fit.pipeline.SimplePipeline; //导入方法依赖的package包/类
public void run()
throws Exception
{
String modelFolder = "target/theModel";
// train the model we will use later
trainModel(modelFolder);
CollectionReaderDescription reader = CollectionReaderFactory.createReaderDescription(
TextReader.class, TextReader.PARAM_SOURCE_LOCATION,
"src/main/resources/raw/rawText.txt", TextReader.PARAM_LANGUAGE, "en");
AnalysisEngineDescription seg = AnalysisEngineFactory
.createEngineDescription(BreakIteratorSegmenter.class);
AnalysisEngineDescription tagger = AnalysisEngineFactory.createEngineDescription(
FlexTagUima.class, FlexTagUima.PARAM_LANGUAGE, "en",
FlexTagUima.PARAM_MODEL_LOCATION, modelFolder);
// a helper class which simply iterates each token and prints the predicted POS tag
AnalysisEngineDescription printer = AnalysisEngineFactory
.createEngineDescription(OutputPrinter.class);
SimplePipeline.runPipeline(reader, seg, tagger, printer);
}
示例8: runMetaCollection
import org.apache.uima.fit.pipeline.SimplePipeline; //导入方法依赖的package包/类
private void runMetaCollection(File luceneFolder)
throws Exception
{
Object[] parameters = new Object[] { LuceneUniGramMetaCollector.PARAM_UNIQUE_EXTRACTOR_NAME,
EXTRACTOR_NAME,
TokenContext.PARAM_SOURCE_LOCATION, luceneFolder.toString(),
LuceneUniGramMetaCollector.PARAM_TARGET_LOCATION, luceneFolder.toString()
};
List<Object> parameterList = new ArrayList<Object>(Arrays.asList(parameters));
CollectionReaderDescription reader = CollectionReaderFactory.createReaderDescription(
TestReaderSingleLabel.class, TestReaderSingleLabel.PARAM_LANGUAGE, "en",
TestReaderSingleLabel.PARAM_SOURCE_LOCATION, "src/test/resources/text/input.txt");
AnalysisEngineDescription segmenter = AnalysisEngineFactory
.createEngineDescription(BreakIteratorSegmenter.class);
AnalysisEngineDescription metaCollector = AnalysisEngineFactory
.createEngineDescription(LuceneUniGramMetaCollector.class, parameterList.toArray());
// run meta collector
SimplePipeline.runPipeline(reader, segmenter, metaCollector);
}
示例9: testMapBackFeature
import org.apache.uima.fit.pipeline.SimplePipeline; //导入方法依赖的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());
}
示例10: main
import org.apache.uima.fit.pipeline.SimplePipeline; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
if (args.length != 3) {
System.out.println("arguments: " //
+ "path to XML descriptor for pipeline, " //
+ "folder with text files, " //
+ "folder to output xmi files");
System.exit(-1);
}
// A collection reader that reads text files
CollectionReader reader = CollectionReaderFactory.createReader(FilesCollectionReader.class,
null, FilesCollectionReader.PARAM_ROOT_FILE, args[1]);
AggregateBuilder builder = new AggregateBuilder();
AnalysisEngineDescription descriptor = (AnalysisEngineDescription) createResourceCreationSpecifier(
new XMLInputSource(RunPipelineXmi.class.getClassLoader().getResourceAsStream(args[0]),
new File(".")), new Object[0]);
builder.add(descriptor);
builder.add(XmiWriter.getDescription(new File(args[2])));
SimplePipeline.runPipeline(reader, builder.createAggregateDescription());
}
示例11: main
import org.apache.uima.fit.pipeline.SimplePipeline; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
if (args.length != 3) {
System.out.println("arguments: " //
+ "path to XML descriptor for pipeline, " //
+ "folder with text files, " //
+ "path to output tsv file");
System.exit(-1);
}
// A collection reader that reads text files
CollectionReader reader = CollectionReaderFactory.createReader(FilesCollectionReader.class,
null, FilesCollectionReader.PARAM_ROOT_FILE, args[1]);
AggregateBuilder builder = new AggregateBuilder();
AnalysisEngineDescription descriptor = (AnalysisEngineDescription) createResourceCreationSpecifier(
new XMLInputSource(RunPipelineTsv.class.getClassLoader().getResourceAsStream(args[0]),
new File(".")), new Object[0]);
builder.add(descriptor);
builder.add(TsvWriter.getDescription(new File(args[2])));
SimplePipeline.runPipeline(reader, builder.createAggregateDescription());
}
示例12: main
import org.apache.uima.fit.pipeline.SimplePipeline; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
// A collection reader that reads XMIs
CollectionReader reader = CollectionReaderFactory.createReader(XReader.class, null, XReader.PARAM_ROOT_FILE,
args[0]);
// The pipeline of annotators
AggregateBuilder builder = new AggregateBuilder();
// other annotators, if needed
builder.add(UIMAFramework.getXMLParser().parseAnalysisEngineDescription(
new XMLInputSource("src/main/resources/org/ie4opendata/octroy/SimpleFrenchTokenAndSentenceAnnotator.xml")));
// Use this to get the parameters for the descriptor
//System.out.println(ReasonAnnotator.getClassifierDescription("org/ie4opendata/octroy/reason/model.jar"));
//System.exit(0);
// The reason classifier annotator, configured to write training data
builder.add(ReasonAnnotator.getWriterDescription("src/main/resources/org/ie4opendata/octroy/reason"));
// Run the pipeline of annotators on each of the CASes produced by the reader
SimplePipeline.runPipeline(reader, builder.createAggregateDescription());
// Train a classifier on the training data, and package it into a .jar file
Train.main("src/main/resources/org/ie4opendata/octroy/reason");
}
示例13: main
import org.apache.uima.fit.pipeline.SimplePipeline; //导入方法依赖的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" });
}
示例14: main
import org.apache.uima.fit.pipeline.SimplePipeline; //导入方法依赖的package包/类
public static void main(String[] args)
{
// TODO set this properly to "gold.data.toulmin" directory
final String annotatedCorpusDir = "/home/user-ukp/research/data/argumentation/habernal.gurevych.2015.argumentation.mining.CL.data/data/gold.data.toulmin/";
try {
SimplePipeline.runPipeline(CollectionReaderFactory.createReaderDescription(
XmiReader.class,
XmiReader.PARAM_SOURCE_LOCATION, annotatedCorpusDir,
XmiReader.PARAM_PATTERNS, "[+]*.xmi"
),
AnalysisEngineFactory.createEngineDescription(
ArgumentDumpWriter.class
)
);
}
catch (Exception e) {
e.printStackTrace();
}
}
示例15: run
import org.apache.uima.fit.pipeline.SimplePipeline; //导入方法依赖的package包/类
private void run() throws Exception {
// make TypeSystemDesc
TypeSystemDescription tsd = TypeSystemDescriptionFactory
.createTypeSystemDescriptionFromPath(tsFile.toURI().toString());
// configure CollectionReader
CollectionReaderDescription colReaderDesc = CollectionReaderFactory.createReaderDescription(
BratCollectionReader.class, tsd,
BratCollectionReader.PARAM_BRAT_COLLECTION_DIR, bratCorpusDir.getPath(),
BratCollectionReader.PARAM_MAPPING_FACTORY_CLASS,
AutoBratUimaMappingFactory.class.getName());
// configure AE
AnalysisEngineDescription aeDesc = createEngineDescription(XmiWriter.class,
XmiWriter.PARAM_OUTPUTDIR, outputDir.getPath());
SimplePipeline.runPipeline(colReaderDesc, aeDesc);
}