public virtual void RunCoref(Document document)
        {
            IDictionary <Pair <int, int>, bool> mentionPairs = CorefUtils.GetUnlabeledMentionPairs(document);

            if (mentionPairs.Count == 0)
            {
                return;
            }
            Compressor <string>         compressor           = new Compressor <string>();
            DocumentExamples            examples             = extractor.Extract(0, document, mentionPairs, compressor);
            ICounter <Pair <int, int> > classificationScores = new ClassicCounter <Pair <int, int> >();
            ICounter <Pair <int, int> > rankingScores        = new ClassicCounter <Pair <int, int> >();
            ICounter <int> anaphoricityScores = new ClassicCounter <int>();

            foreach (Example example in examples.examples)
            {
                CorefUtils.CheckForInterrupt();
                Pair <int, int> mentionPair = new Pair <int, int>(example.mentionId1, example.mentionId2);
                classificationScores.IncrementCount(mentionPair, classificationModel.Predict(example, examples.mentionFeatures, compressor));
                rankingScores.IncrementCount(mentionPair, rankingModel.Predict(example, examples.mentionFeatures, compressor));
                if (!anaphoricityScores.ContainsKey(example.mentionId2))
                {
                    anaphoricityScores.IncrementCount(example.mentionId2, anaphoricityModel.Predict(new Example(example, false), examples.mentionFeatures, compressor));
                }
            }
            ClustererDataLoader.ClustererDoc doc = new ClustererDataLoader.ClustererDoc(0, classificationScores, rankingScores, anaphoricityScores, mentionPairs, null, document.predictedMentionsByID.Stream().Collect(Collectors.ToMap(null, null)));
            foreach (Pair <int, int> mentionPair_1 in clusterer.GetClusterMerges(doc))
            {
                CorefUtils.MergeCoreferenceClusters(mentionPair_1, document);
            }
        }
 /// <summary>main entry of coreference system.</summary>
 /// <param name="document">Input document for coref format (Annotation and optional information)</param>
 /// <param name="output">For output of coref system (conll format and log. list size should be 4.)</param>
 /// <returns>Map of coref chain ID and corresponding chain</returns>
 /// <exception cref="System.Exception"/>
 public virtual IDictionary <int, CorefChain> Coref(Document document, StringBuilder[] output)
 {
     if (HybridCorefProperties.PrintMDLog(props))
     {
         Redwood.Log(HybridCorefPrinter.PrintMentionDetectionLog(document));
     }
     if (HybridCorefProperties.DoScore(props))
     {
         output[0] = (new StringBuilder()).Append(CorefPrinter.PrintConllOutput(document, true));
         // gold
         output[1] = (new StringBuilder()).Append(CorefPrinter.PrintConllOutput(document, false));
     }
     // before coref
     output[3] = new StringBuilder();
     // log from sieves
     foreach (Edu.Stanford.Nlp.Coref.Hybrid.Sieve.Sieve sieve in sieves)
     {
         CorefUtils.CheckForInterrupt();
         output[3].Append(sieve.ResolveMention(document, dictionaries, props));
     }
     // post processing
     if (HybridCorefProperties.DoPostProcessing(props))
     {
         PostProcessing(document);
     }
     if (HybridCorefProperties.DoScore(props))
     {
         output[2] = (new StringBuilder()).Append(CorefPrinter.PrintConllOutput(document, false, true));
     }
     // after coref
     return(MakeCorefOutput(document));
 }