ExamplePosAnnotator extends CleartkSequenceAnnotator<String> { public static AnalysisEngineDescription getWriterDescription(String outputDirectory) throws ResourceInitializationException { return AnalysisEngineFactory.createEngineDescription( ExamplePosAnnotator.class, CleartkSequenceAnnotator.PARAM_DATA_WRITER_FACTORY_CLASS_NAME, ViterbiDataWriterFactory.class.getName(), DirectoryDataWriterFactory.PARAM_OUTPUT_DIRECTORY, outputDirectory, ViterbiDataWriterFactory.PARAM_DELEGATED_DATA_WRITER_FACTORY_CLASS, DefaultDataWriterFactory.class.getName(), DefaultDataWriterFactory.PARAM_DATA_WRITER_CLASS_NAME, MaxentStringOutcomeDataWriter.class.getName(), ViterbiDataWriterFactory.PARAM_OUTCOME_FEATURE_EXTRACTOR_NAMES, new String[] { DefaultOutcomeFeatureExtractor.class.getName() }); }  void initialize(UimaContext context); void process(JCas jCas); static AnalysisEngineDescription getClassifierDescription(String modelFileName); static AnalysisEngineDescription getWriterDescription(String outputDirectory); static final String DEFAULT_OUTPUT_DIRECTORY; }
@Test public void testDataWriterDescriptor() throws UIMAException { AnalysisEngine engine = AnalysisEngineFactory.createEngine(ExamplePosAnnotator.getWriterDescription(ExamplePosAnnotator.DEFAULT_OUTPUT_DIRECTORY)); String outputDir = (String) engine.getConfigParameterValue(DirectoryDataWriterFactory.PARAM_OUTPUT_DIRECTORY); outputDir = outputDir.replace(File.separatorChar, '/'); Assert.assertEquals(ExamplePosAnnotator.DEFAULT_OUTPUT_DIRECTORY, outputDir); String expectedDataWriterFactory = (ViterbiDataWriterFactory.class.getName()); Object dataWriter = engine.getConfigParameterValue(CleartkSequenceAnnotator.PARAM_DATA_WRITER_FACTORY_CLASS_NAME); Assert.assertEquals(expectedDataWriterFactory, dataWriter); engine.collectionProcessComplete(); }