TimeMlAnnotate { public static void main(String... args) throws Exception { if (args.length != 1 && args.length != 2) { error("wrong number of arguments"); } else if (!new File(args[0]).exists()) { error("file or directory not found: " + args[0]); } String inputFileOrDir = args[0]; File outputDir = new File(args.length == 2 ? args[1] : "."); if (!outputDir.exists()) { outputDir.mkdirs(); } SimplePipeline.runPipeline( FilesCollectionReader.getCollectionReader(inputFileOrDir), SentenceAnnotator.getDescription(), TokenAnnotator.getDescription(), PosTaggerAnnotator.getDescription(), DefaultSnowballStemmer.getDescription("English"), ParserAnnotator.getDescription(), TimeAnnotator.FACTORY.getAnnotatorDescription(), TimeTypeAnnotator.FACTORY.getAnnotatorDescription(), EventAnnotator.FACTORY.getAnnotatorDescription(), EventTenseAnnotator.FACTORY.getAnnotatorDescription(), EventAspectAnnotator.FACTORY.getAnnotatorDescription(), EventClassAnnotator.FACTORY.getAnnotatorDescription(), EventPolarityAnnotator.FACTORY.getAnnotatorDescription(), EventModalityAnnotator.FACTORY.getAnnotatorDescription(), AnalysisEngineFactory.createEngineDescription(AddEmptyDCT.class), TemporalLinkEventToDocumentCreationTimeAnnotator.FACTORY.getAnnotatorDescription(), TemporalLinkEventToSameSentenceTimeAnnotator.FACTORY.getAnnotatorDescription(), TemporalLinkEventToSubordinatedEventAnnotator.FACTORY.getAnnotatorDescription(), TempEval2007Writer.getDescription(outputDir.getPath())); }  static void main(String... args);  }
@Test public void test() throws Exception { assumeBigMemoryTestsEnabled(); this.logger.info(BIG_MEMORY_TEST_MESSAGE); TimeMlAnnotate.main(this.inputFile.getPath(), this.tempDir.getPath()); String output = FileUtils.readFileToString(this.outputFile); output = output.replaceAll("\r\n", "\n"); String expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<TimeML>" + "<TIMEX3 tid=\"t0\" functionInDocument=\"CREATION_TIME\"/>" + "In" + " <TIMEX3 tid=\"t1\" type=\"DATE\">August 2010</TIMEX3>, the U.S. Central Intelligence Agency had" + " <EVENT eid=\"e1\" class=\"OCCURRENCE\" tense=\"PAST\" aspect=\"PERFECTIVE\" polarity=\"POS\" modality=\"none\">identified</EVENT>" + " a compound in Abbottabad in Pakistan as the likely location of bin Laden. " + "On <TIMEX3 tid=\"t2\" type=\"DATE\">May 1, 2011</TIMEX3>, President Barack Obama" + " <EVENT eid=\"e2\" class=\"I_ACTION\" tense=\"PAST\" aspect=\"NONE\" polarity=\"POS\" modality=\"none\">ordered</EVENT>" + " Navy SEALs to" + " <EVENT eid=\"e3\" class=\"OCCURRENCE\" tense=\"INFINITIVE\" aspect=\"NONE\" polarity=\"POS\" modality=\"none\">assault</EVENT>" + " the compound." + "<TLINK relType=\"BEFORE\" eventID=\"e1\" relatedToTime=\"t0\"/>" + "<TLINK relType=\"AFTER\" eventID=\"e3\" relatedToTime=\"t0\"/>" + "<TLINK relType=\"IS_INCLUDED\" eventID=\"e2\" relatedToTime=\"t2\"/>" + "<TLINK relType=\"BEFORE\" eventID=\"e2\" relatedToEvent=\"e3\"/>"+ "<TLINK relType=\"IS_INCLUDED\" eventID=\"e3\" relatedToTime=\"t2\"/>" + "<TLINK relType=\"IS_INCLUDED\" eventID=\"e1\" relatedToTime=\"t1\"/>" + "<TLINK relType=\"BEFORE\" eventID=\"e2\" relatedToTime=\"t0\"/>" + "</TimeML>"; Assert.assertEquals("TimeML output should match", expected, output); }