LemmaEmbeddingsPipeline { public static void main(String[] args) throws IOException, UIMAException { String inputDir = args.length > 0 ? args[0] : DEFAULT_SOURCE_DIR; CollectionReaderDescription reader = createReaderDescription(TextReader.class, TextReader.PARAM_SOURCE_LOCATION, inputDir, TextReader.PARAM_LANGUAGE, LANGUAGE); AnalysisEngineDescription segmenter = createEngineDescription(OpenNlpSegmenter.class); AnalysisEngineDescription posTagger = createEngineDescription(StanfordPosTagger.class); AnalysisEngineDescription stopwordRemover = createEngineDescription(StopWordRemover.class, StopWordRemover.PARAM_MODEL_LOCATION, STOPWORD_FILE); AnalysisEngineDescription lemmatizer = createEngineDescription(StanfordLemmatizer.class); AnalysisEngineDescription embeddings = createEngineDescription( MalletEmbeddingsTrainer.class, MalletEmbeddingsTrainer.PARAM_TARGET_LOCATION, TARGET_FILE, MalletEmbeddingsTrainer.PARAM_NUM_THREADS, NUM_THREADS, MalletEmbeddingsTrainer.PARAM_TOKEN_FEATURE_PATH, FEATURE_PATH); SimplePipeline .runPipeline(reader, segmenter, posTagger, lemmatizer, stopwordRemover, embeddings); }  static void main(String[] args); static final File TARGET_FILE; }
@Test public void testMain() throws Exception { int expectedSize = 27; int dimensionality = 50; LemmaEmbeddingsPipeline.TARGET_FILE.delete(); LemmaEmbeddingsPipeline.main(new String[] {}); List<String> output = Files.readAllLines(LemmaEmbeddingsPipeline.TARGET_FILE.toPath()); assertEquals(expectedSize, output.size()); assertTrue(output.stream().allMatch(line -> line.split(" ").length == dimensionality + 1)); }