/// <exception cref="System.TypeLoadException"/>
        /// <exception cref="System.IO.IOException"/>
        private CorefMentionFinder GetMentionFinder(Properties props, IHeadFinder headFinder)
        {
            switch (CorefProperties.MdType(props))
            {
            case CorefProperties.MentionDetectionType.Dependency:
            {
                mdName = "dependency";
                return(new DependencyCorefMentionFinder(props));
            }

            case CorefProperties.MentionDetectionType.Hybrid:
            {
                mdName = "hybrid";
                mentionAnnotatorRequirements.Add(typeof(TreeCoreAnnotations.TreeAnnotation));
                mentionAnnotatorRequirements.Add(typeof(CoreAnnotations.BeginIndexAnnotation));
                mentionAnnotatorRequirements.Add(typeof(CoreAnnotations.EndIndexAnnotation));
                return(new HybridCorefMentionFinder(headFinder, props));
            }

            case CorefProperties.MentionDetectionType.Rule:
            default:
            {
                mentionAnnotatorRequirements.Add(typeof(TreeCoreAnnotations.TreeAnnotation));
                mentionAnnotatorRequirements.Add(typeof(CoreAnnotations.BeginIndexAnnotation));
                mentionAnnotatorRequirements.Add(typeof(CoreAnnotations.EndIndexAnnotation));
                mdName = "rule";
                return(new RuleBasedCorefMentionFinder(headFinder, props));
            }
            }
        }
Example #2
0
        public virtual ICollection <Type> Requires()
        {
            ICollection <Type> requirements = new HashSet <Type>(Arrays.AsList(typeof(CoreAnnotations.TextAnnotation), typeof(CoreAnnotations.TokensAnnotation), typeof(CoreAnnotations.CharacterOffsetBeginAnnotation), typeof(CoreAnnotations.CharacterOffsetEndAnnotation
                                                                                                                                                                                                                                ), typeof(CoreAnnotations.IndexAnnotation), typeof(CoreAnnotations.ValueAnnotation), typeof(CoreAnnotations.SentencesAnnotation), typeof(CoreAnnotations.SentenceIndexAnnotation), typeof(CoreAnnotations.PartOfSpeechAnnotation), typeof(CoreAnnotations.LemmaAnnotation
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          ), typeof(CoreAnnotations.NamedEntityTagAnnotation), typeof(CoreAnnotations.EntityTypeAnnotation), typeof(CoreAnnotations.MentionsAnnotation), typeof(CoreAnnotations.EntityMentionIndexAnnotation), typeof(CoreAnnotations.CoarseNamedEntityTagAnnotation
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ), typeof(CoreAnnotations.FineGrainedNamedEntityTagAnnotation), typeof(SemanticGraphCoreAnnotations.BasicDependenciesAnnotation), typeof(SemanticGraphCoreAnnotations.EnhancedDependenciesAnnotation)));

            if (CorefProperties.MdType(this.props) != CorefProperties.MentionDetectionType.Dependency)
            {
                requirements.Add(typeof(TreeCoreAnnotations.TreeAnnotation));
                requirements.Add(typeof(CoreAnnotations.CategoryAnnotation));
            }
            if (!performMentionDetection)
            {
                requirements.Add(typeof(CorefCoreAnnotations.CorefMentionsAnnotation));
            }
            return(Java.Util.Collections.UnmodifiableSet(requirements));
        }