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