public static double GetFinalConllScoreFromOutputDir(string corefOutputDir, string scorerPath) { File baseFolder = new File(corefOutputDir); File[] filesInBaseFolder = baseFolder.ListFiles(); string baseName = corefOutputDir; foreach (File outputFile in filesInBaseFolder) { string outputFileName = outputFile.GetName(); baseName = baseName + "/" + outputFileName.Split("\\.")[0]; break; } string goldOutput = baseName + ".gold.txt"; string afterCorefOutput = baseName + ".coref.predicted.txt"; try { string summary = CorefScorer.GetEvalSummary(scorerPath, goldOutput, afterCorefOutput); double finalScore = GetFinalConllScore(summary); return(finalScore); } catch (IOException) { Redwood.Log("Error: failed to get coref score from directory"); return(-1); } }
/// <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(); }