public CorefSystem(Properties props) { try { Dictionaries dictionaries = new Dictionaries(props); docMaker = new DocumentMaker(props, dictionaries); corefAlgorithm = ICorefAlgorithm.FromProps(props, dictionaries); removeSingletonClusters = CorefProperties.RemoveSingletonClusters(props); verbose = CorefProperties.Verbose(props); } catch (Exception e) { throw new Exception("Error initializing coref system", e); } }
/// <exception cref="System.Exception"/> public virtual void RunOnConll(Properties props) { string baseName = CorefProperties.ConllOutputPath(props) + Calendar.GetInstance().GetTime().ToString().ReplaceAll("\\s", "-").ReplaceAll(":", "-"); string goldOutput = baseName + ".gold.txt"; string beforeCorefOutput = baseName + ".predicted.txt"; string afterCorefOutput = baseName + ".coref.predicted.txt"; PrintWriter writerGold = new PrintWriter(new FileOutputStream(goldOutput)); PrintWriter writerBeforeCoref = new PrintWriter(new FileOutputStream(beforeCorefOutput)); PrintWriter writerAfterCoref = new PrintWriter(new FileOutputStream(afterCorefOutput)); (new _ICorefDocumentProcessor_82(this, writerGold, writerBeforeCoref, writerAfterCoref)).Run(docMaker); Logger logger = Logger.GetLogger(typeof(Edu.Stanford.Nlp.Coref.CorefSystem).FullName); string summary = CorefScorer.GetEvalSummary(CorefProperties.GetScorerPath(props), goldOutput, beforeCorefOutput); CorefScorer.PrintScoreSummary(summary, logger, false); summary = CorefScorer.GetEvalSummary(CorefProperties.GetScorerPath(props), goldOutput, afterCorefOutput); CorefScorer.PrintScoreSummary(summary, logger, true); CorefScorer.PrintFinalConllScore(summary); writerGold.Close(); writerBeforeCoref.Close(); writerAfterCoref.Close(); }