コード例 #1
0
        public virtual void Annotate(Annotation ann)
        {
            Document document;

            try
            {
                document = docMaker.MakeDocument(ann);
            }
            catch (Exception e)
            {
                throw new Exception("Error making document", e);
            }
            CorefUtils.CheckForInterrupt();
            corefAlgorithm.RunCoref(document);
            if (removeSingletonClusters)
            {
                CorefUtils.RemoveSingletonClusters(document);
            }
            CorefUtils.CheckForInterrupt();
            IDictionary <int, CorefChain> result = Generics.NewHashMap();

            foreach (CorefCluster c in document.corefClusters.Values)
            {
                result[c.clusterID] = new CorefChain(c, document.positions);
            }
            ann.Set(typeof(CorefCoreAnnotations.CorefChainAnnotation), result);
        }
コード例 #2
0
            public void Process(int id, Document document)
            {
                writerGold.Print(CorefPrinter.PrintConllOutput(document, true));
                writerBeforeCoref.Print(CorefPrinter.PrintConllOutput(document, false));
                long time = Runtime.CurrentTimeMillis();

                this._enclosing.corefAlgorithm.RunCoref(document);
                if (this._enclosing.verbose)
                {
                    Redwood.Log(this.GetName(), "Coref took " + (Runtime.CurrentTimeMillis() - time) / 1000.0 + "s");
                }
                CorefUtils.RemoveSingletonClusters(document);
                writerAfterCoref.Print(CorefPrinter.PrintConllOutput(document, false, true));
            }
コード例 #3
0
 public static IDictionary <Pair <int, int>, bool> GetUnlabeledMentionPairs(Document document)
 {
     return(CorefUtils.GetMentionPairs(document).Stream().Collect(Collectors.ToMap(null, null)));
 }