/** * Get an {@link AnalysisEngineDescription} from an XML descriptor file and a set of configuration * parameters. * * @param descriptorPath * The path to the XML descriptor file. * @param configurationData * Any additional configuration parameters to be set. These should be supplied as (name, * value) pairs, so there should always be an even number of parameters. * @return The {@link AnalysisEngineDescription} created from the XML descriptor and the * configuration parameters. * @throws IOException * if an I/O error occurs * @throws InvalidXMLException * if the input XML is not valid or does not specify a valid {@link ResourceSpecifier} * @deprecated use {@link #createEngineDescriptionFromPath(String, Object...)} */ @Deprecated public static AnalysisEngineDescription createAnalysisEngineDescriptionFromPath( String descriptorPath, Object... configurationData) throws InvalidXMLException, IOException { return createEngineDescriptionFromPath(descriptorPath, configurationData); }
public static void main(String[] args) throws UIMAException, IOException, CmdLineException { Options options = new Options(); CmdLineParser parser = new CmdLineParser(options); parser.parseArgument(args); CollectionReaderDescription collectionReader = CollectionReaderFactory.createReaderDescriptionFromPath( "../ctakes-core/desc/collection_reader/FilesInDirectoryCollectionReader.xml", ConfigParameterConstants.PARAM_INPUTDIR, options.inputDirectory ); // make sure the model parameters match those used for training AnalysisEngineDescription relationExtractor = AnalysisEngineFactory.createEngineDescriptionFromPath( "desc/analysis_engine/RelationExtractorAggregate.xml"); int fileNum = 0; for(JCas jcas : SimplePipeline.iteratePipeline(collectionReader, relationExtractor)){ CasIOUtil.writeXmi(jcas, new File(options.outputDirectory, String.format("%d.txt", fileNum++))); } } }
public static void main(String[] args) throws UIMAException, IOException, CmdLineException { Options options = new Options(); CmdLineParser parser = new CmdLineParser(options); parser.parseArgument(args); CollectionReaderDescription collectionReader = CollectionReaderFactory.createReaderDescriptionFromPath( "../ctakes-core/desc/collection_reader/FilesInDirectoryCollectionReader.xml", ConfigParameterConstants.PARAM_INPUTDIR, options.inputDirectory ); // make sure the model parameters match those used for training AnalysisEngineDescription relationExtractor = AnalysisEngineFactory.createEngineDescriptionFromPath( "desc/analysis_engine/RelationExtractorAggregate.xml"); int fileNum = 0; for(JCas jcas : SimplePipeline.iteratePipeline(collectionReader, relationExtractor)){ CasIOUtil.writeXmi(jcas, new File(options.outputDirectory, String.format("%d.txt", fileNum++))); } } }
/** * Get an {@link AnalysisEngine} from an XML descriptor file and a set of configuration * parameters. * * @param descriptorPath * The path to the XML descriptor file. * @param configurationData * Any additional configuration parameters to be set. These should be supplied as (name, * value) pairs, so there should always be an even number of parameters. * @return The {@link AnalysisEngine} created from the XML descriptor and the configuration * parameters. * @throws IOException * if an I/O error occurs * @throws InvalidXMLException * if the input XML is not valid or does not specify a valid {@link ResourceSpecifier} * @throws ResourceInitializationException * if a failure occurred during production of the resource. * @see <a href="package-summary.html#InstancesVsDescriptors">Why are descriptors better than * component instances?</a> */ public static AnalysisEngine createEngineFromPath(String descriptorPath, Object... configurationData) throws InvalidXMLException, IOException, ResourceInitializationException { AnalysisEngineDescription desc = createEngineDescriptionFromPath(descriptorPath, configurationData); return UIMAFramework.produceAnalysisEngine(desc, ResourceManagerFactory.newResourceManager(), null); }
pipeline.addAe(createEngineDescriptionFromPath( aeXml.getAbsolutePath(), params.getKey().toArray())); } catch (Exception e) {