public static void main(String[] args) throws Exception { long startTime = System.currentTimeMillis(); parseOptions = new ParseOptions(args); SemanticRoleLabeler srl; if (parseOptions.useReranker) { srl = new Reranker(parseOptions); // srl = // Reranker.fromZipFile(zipFile,parseOptions.skipPI,parseOptions.global_alfa,parseOptions.global_aiBeam,parseOptions.global_acBeam); } else { ZipFile zipFile = new ZipFile(parseOptions.modelFile); srl = parseOptions.skipPD ? Pipeline.fromZipFile(zipFile, new Step[] {Step.ai, Step.ac}) : parseOptions.skipPI ? Pipeline.fromZipFile(zipFile, new Step[] {Step.pd, Step.ai, Step.ac /* * ,Step.po, * Step.ao */}) : Pipeline.fromZipFile(zipFile); zipFile.close(); } SentenceWriter writer = null; if (parseOptions.printXML) writer = new FrameNetXMLWriter(parseOptions.output); else writer = new CoNLL09Writer(parseOptions.output); SentenceReader reader = parseOptions.skipPI ? new SRLOnlyCoNLL09Reader(parseOptions.inputCorpus) : new DepsOnlyCoNLL09Reader(parseOptions.inputCorpus); int senCount = 0; for (Sentence s : reader) { senCount++; if (senCount % 100 == 0) System.out.println("Parsing sentence " + senCount); srl.parseSentence(s); if (parseOptions.writeCoref) writer.specialwrite(s); else writer.write(s); } writer.close(); reader.close(); long totalTime = System.currentTimeMillis() - startTime; System.out.println("Done."); System.out.println(srl.getStatus()); System.out.println(); System.out.println("Total execution time: " + Util.insertCommas(totalTime) + "ms"); }
public static void main(String[] args) throws Exception { CompletePipelineCMDLineOptions options = new CompletePipelineCMDLineOptions(); options.parseCmdLineArgs(args); String error = FileExistenceVerifier.verifyCompletePipelineAllNecessaryModelFiles(options); if (error != null) { System.err.println(error); System.err.println(); System.err.println("Aborting."); System.exit(1); } CompletePipeline pipeline = getCompletePipeline(options); BufferedReader in = new BufferedReader( new InputStreamReader(new FileInputStream(options.input), Charset.forName("UTF-8"))); SentenceWriter writer = null; if (options.printANN) writer = new ANNWriter(options.output); else writer = new CoNLL09Writer(options.output); long start = System.currentTimeMillis(); int senCount; if (options.glovedir != null) { senCount = parseFullDocument(options, pipeline, in, writer); } else if (options.loadPreprocessorWithTokenizer) { senCount = parseNonSegmentedLineByLine(options, pipeline, in, writer); } else { senCount = parseCoNLL09(options, pipeline, in, writer); } in.close(); writer.close(); long time = System.currentTimeMillis() - start; System.out.println(pipeline.getStatusString()); System.out.println(); System.out.println("Total parsing time (ms): " + Util.insertCommas(time)); System.out.println("Overall speed (ms/sen): " + Util.insertCommas(time / senCount)); }