/** * Create a CollectionReader 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 CollectionReader created from the XML descriptor and the configuration parameters. * @deprecated use {@link #createReaderDescriptionFromPath(String, Object...)} * @throws UIMAException * if the descriptor could not be created or if the component could not be instantiated * @throws IOException * if the descriptor could not be read */ @Deprecated public static CollectionReaderDescription createCollectionReaderDescriptionFromPath( String descriptorPath, Object... configurationData) throws UIMAException, IOException { return createReaderDescriptionFromPath(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++))); } } }
/** * Create a CollectionReader 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 CollectionReader created from the XML descriptor and the configuration parameters. * @throws UIMAException * if the descriptor could not be created or if the component could not be instantiated * @throws IOException * if the descriptor could not be read */ public static CollectionReader createReaderFromPath(String descriptorPath, Object... configurationData) throws UIMAException, IOException { CollectionReaderDescription desc = createReaderDescriptionFromPath(descriptorPath, configurationData); return UIMAFramework.produceCollectionReader(desc, ResourceManagerFactory.newResourceManager(), null); }