当前位置: 首页>>代码示例>>C#>>正文


C# Mention类代码示例

本文整理汇总了C#中Mention的典型用法代码示例。如果您正苦于以下问题:C# Mention类的具体用法?C# Mention怎么用?C# Mention使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Mention类属于命名空间,在下文中一共展示了Mention类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CanResolve

 public override bool CanResolve(Mention.MentionContext mention)
 {
     string firstToken = mention.FirstTokenText.ToLower();
     string firstTokenTag = mention.FirstToken.SyntacticType;
     bool canResolve = mention.HeadTokenTag == "NN" && !IsDefiniteArticle(firstToken, firstTokenTag);
     return canResolve;
 }
开发者ID:JJColeman,项目名称:jcoleman_Capstone,代码行数:7,代码来源:CommonNounResolver.cs

示例2: DiscourseEntity

 /// <summary>
 /// Creates a new entity based on the specified mention and its specified gender and number properties.
 /// </summary>
 /// <param name="mention">
 /// The first mention of this entity.
 /// </param>
 /// <param name="gender">
 /// The gender of this entity.
 /// </param>
 /// <param name="genderProbability">
 /// The probability that the specified gender is correct.
 /// </param>
 /// <param name="number">
 /// The number for this entity.
 /// </param>
 /// <param name="numberProbability">
 /// The probability that the specified number is correct.
 /// </param>
 public DiscourseEntity(Mention.MentionContext mention, Similarity.GenderEnum gender, double genderProbability, Similarity.NumberEnum number, double numberProbability)
     : base(mention)
 {
     mGender = gender;
     mGenderProbability = genderProbability;
     mNumber = number;
     mNumberProbability = numberProbability;
 }
开发者ID:JJColeman,项目名称:jcoleman_Capstone,代码行数:26,代码来源:DiscourseEntity.cs

示例3: CanResolve

        public override bool CanResolve(Mention.MentionContext mention)
		{
			string firstToken = mention.FirstTokenText.ToLower();
			string firstTokenTag = mention.FirstToken.SyntacticType;
			bool canResolve = mention.HeadTokenTag == PartsOfSpeech.NounSingularOrMass 
                && !IsDefiniteArticle(firstToken, firstTokenTag);
			return canResolve;
		}
开发者ID:gblosser,项目名称:OpenNlp,代码行数:8,代码来源:CommonNounResolver.cs

示例4: GetNonReferentialProbability

 public virtual double GetNonReferentialProbability(Mention.MentionContext mention)
 {
     List<string> features = GetFeatures(mention);
     double probability = mModel.Evaluate(features.ToArray())[mNonReferentialIndex];
     if (mDebugOn)
     {
         System.Console.Error.WriteLine(this + " " + mention.ToText() + " ->  null " + probability + " " + string.Join(",", features.ToArray()));
     }
     return probability;
 }
开发者ID:dmoonfire,项目名称:sharpnlp,代码行数:10,代码来源:DefaultNonReferentialResolver.cs

示例5: GetFeatures

        protected internal override List<string> GetFeatures(Mention.MentionContext mention, DiscourseEntity entity)
        {
            List<string> features = base.GetFeatures(mention, entity);

            if (entity != null)
            {
                features.AddRange(GetContextFeatures(mention));
                features.AddRange(GetStringMatchFeatures(mention, entity));
            }
            return features;
        }
开发者ID:JJColeman,项目名称:jcoleman_Capstone,代码行数:11,代码来源:CommonNounResolver.cs

示例6: IsExcluded

		protected internal override bool IsExcluded(Mention.MentionContext entityContext, DiscourseEntity discourseEntity)
		{
			if (base.IsExcluded(entityContext, discourseEntity))
			{
				return true;
			}
			else
			{
                Mention.MentionContext currentEntityContext = discourseEntity.LastExtent;
				return (!CanResolve(currentEntityContext) || base.IsExcluded(entityContext, discourseEntity));
			}
		}
开发者ID:gblosser,项目名称:OpenNlp,代码行数:12,代码来源:CommonNounResolver.cs

示例7: AddEvent

 public virtual void AddEvent(Mention.MentionContext context)
 {
     List<string> features = GetFeatures(context);
     if (context.Id == -1)
     {
         mEvents.Add(new SharpEntropy.TrainingEvent(MaximumEntropyResolver.Same, features.ToArray()));
     }
     else
     {
         mEvents.Add(new SharpEntropy.TrainingEvent(MaximumEntropyResolver.Diff, features.ToArray()));
     }
 }
开发者ID:dmoonfire,项目名称:sharpnlp,代码行数:12,代码来源:DefaultNonReferentialResolver.cs

示例8: Initialize

        private void Initialize(Mention.IHeadFinder headFinder)
		{
            Mention.IParse head = headFinder.GetLastHead(Parse);
			List<Mention.IParse> tokenList = head.Tokens;
			this.HeadTokenIndex = headFinder.GetHeadIndex(head);
            Mention.IParse headToken = headFinder.GetHeadToken(head);
            _tokens = tokenList.ToArray();
			this.HeadTokenTag = headToken.SyntacticType;
			this.HeadTokenText = headToken.ToString();
			if (PartsOfSpeech.IsNoun(this.HeadTokenTag) && !PartsOfSpeech.IsProperNoun(this.HeadTokenTag))
			{
				this.Synsets = GetSynsetSet(this);
			}
			else
			{
				this.Synsets = new Util.HashSet<string>();
			}
		}
开发者ID:gblosser,项目名称:OpenNlp,代码行数:18,代码来源:Context.cs

示例9: IsOutOfRange

 /// <summary>
 /// Determines if the specified entity is too far from the specified mention to be resolved to it.  
 /// Once an entity has been determined to be out of range subsequent entities are not considered.
 /// </summary>
 /// <seealso cref="IsExcluded">
 /// </seealso>
 /// <param name="mention">
 /// The mention which is being considered.
 /// </param>
 /// <param name="entity">
 /// The entity to which the mention is to be resolved.
 /// </param>
 /// <returns>
 /// true is the entity is in range of the mention, false otherwise.
 /// </returns>
 protected internal virtual bool IsOutOfRange(Mention.MentionContext mention, DiscourseEntity entity)
 {
     return false;
 }
开发者ID:ronnyMakhuddin,项目名称:SharperNLP,代码行数:19,代码来源:AbstractResolver.cs

示例10: GetHeadString

 /// <summary>
 /// Returns the text of the head word for the specified mention.
 /// </summary>
 /// <param name="mention">
 /// The mention.
 /// </param>
 /// <returns>
 /// The text of the head word for the specified mention.
 /// </returns>
 protected internal virtual string GetHeadString(Mention.MentionContext mention)
 {
     return mention.HeadTokenText.ToLower();
 }
开发者ID:ronnyMakhuddin,项目名称:SharperNLP,代码行数:13,代码来源:AbstractResolver.cs

示例11: GetHead

 /// <summary>
 /// Returns the head parse for the specified mention.
 /// </summary>
 /// <param name="mention">
 /// The mention.
 /// </param>
 /// <returns>
 /// the head parse for the specified mention.
 /// </returns>
 protected internal virtual Mention.IParse GetHead(Mention.MentionContext mention)
 {
     return mention.HeadTokenParse;
 }
开发者ID:ronnyMakhuddin,项目名称:SharperNLP,代码行数:13,代码来源:AbstractResolver.cs

示例12: Retain

 public virtual DiscourseEntity Retain(Mention.MentionContext mention, DiscourseModel discourseModel)
 {
     int entityIndex = 0;
     if (mention.Id == - 1)
     {
         return null;
     }
     for (; entityIndex < discourseModel.EntityCount; entityIndex++)
     {
         DiscourseEntity currentDiscourseEntity = discourseModel.GetEntity(entityIndex);
         Mention.MentionContext candidateExtentContext = currentDiscourseEntity.LastExtent;
         if (candidateExtentContext.Id == mention.Id)
         {
             Distances.Add(entityIndex);
             return currentDiscourseEntity;
         }
     }
     //System.err.println("AbstractResolver.Retain: non-referring entity with id: "+ec.toText()+" id="+ec.id);
     return null;
 }
开发者ID:ronnyMakhuddin,项目名称:SharperNLP,代码行数:20,代码来源:AbstractResolver.cs

示例13: CanResolve

 public abstract bool CanResolve(Mention.MentionContext mention);
开发者ID:ronnyMakhuddin,项目名称:SharperNLP,代码行数:1,代码来源:AbstractResolver.cs

示例14: GetCompatibilityFeatures

 /// <summary>
 /// Returns features indicating whether the specified mention and the specified entity are compatible.
 /// </summary>
 /// <param name="mention">
 /// The mention.
 /// </param>
 /// <param name="entity">
 /// The entity.
 /// </param>
 /// <returns> 
 /// list of features indicating whether the specified mention and the specified entity are compatible.
 /// </returns>
 private List<string> GetCompatibilityFeatures(Mention.MentionContext mention, DiscourseEntity entity)
 {
     List<string> compatibilityFeatures = new List<string>();
     string semanticCompatibilityFeature = GetSemanticCompatibilityFeature(mention, entity);
     compatibilityFeatures.Add(semanticCompatibilityFeature);
     string genderCompatibilityFeature = GetGenderCompatibilityFeature(mention, entity);
     compatibilityFeatures.Add(genderCompatibilityFeature);
     string numberCompatibilityFeature = GetNumberCompatibilityFeature(mention, entity);
     compatibilityFeatures.Add(numberCompatibilityFeature);
     if (semanticCompatibilityFeature == mSimilarityCompatible && genderCompatibilityFeature == mGenderCompatible && numberCompatibilityFeature == mNumberCompatible)
     {
         compatibilityFeatures.Add("all.compatible");
     }
     else if (semanticCompatibilityFeature == mSimilarityIncompatible || genderCompatibilityFeature == mGenderIncompatible || numberCompatibilityFeature == mNumberIncompatible)
     {
         compatibilityFeatures.Add("some.incompatible");
     }
     return compatibilityFeatures;
 }
开发者ID:JJColeman,项目名称:jcoleman_Capstone,代码行数:31,代码来源:MaximumEntropyResolver.cs

示例15: Retain

        public override DiscourseEntity Retain(Mention.MentionContext mention, DiscourseModel discourseModel)
        {
            //System.err.println(this+".retain("+ec+") "+mode);
            if (mResolverMode == ResolverMode.Train)
            {
                DiscourseEntity discourseEntity = null;
                bool referentFound = false;
                bool hasReferentialCandidate = false;
                bool nonReferentFound = false;
                for (int entityIndex = 0; entityIndex < GetNumberEntitiesBack(discourseModel); entityIndex++)
                {
                    DiscourseEntity currentDiscourseEntity = discourseModel.GetEntity(entityIndex);
                    Mention.MentionContext entityMention = currentDiscourseEntity.LastExtent;
                    if (IsOutOfRange(mention, currentDiscourseEntity))
                    {
                        if (mention.Id != -1 && !referentFound)
                        {
                            //System.err.println("retain: Referent out of range: "+ec.toText()+" "+ec.parse.getSpan());
                        }
                        break;
                    }
                    if (IsExcluded(mention, currentDiscourseEntity))
                    {
                        if (ShowExclusions)
                        {
                            if (mention.Id != - 1 && entityMention.Id == mention.Id)
                            {
                                System.Console.Error.WriteLine(this + ".retain: Referent excluded: (" + mention.Id + ") " + mention.ToText() + " " + mention.IndexSpan + " -> (" + entityMention.Id + ") " + entityMention.ToText() + " " + entityMention.Span + " " + this);
                            }
                        }
                    }
                    else
                    {
                        hasReferentialCandidate = true;
                        bool useAsDifferentExample = defaultReferent(currentDiscourseEntity);
                        //if (!sampleSelection || (mention.getId() != -1 && entityMention.getId() == mention.getId()) || (!nonReferentFound && useAsDifferentExample)) {
                        List<string> features = GetFeatures(mention, currentDiscourseEntity);

                        //add Event to Model
                        if (mDebugOn)
                        {
                            System.Console.Error.WriteLine(this + ".retain: " + mention.Id + " " + mention.ToText() + " -> " + entityMention.Id + " " + currentDiscourseEntity);
                        }
                        if (mention.Id != - 1 && entityMention.Id == mention.Id)
                        {
                            referentFound = true;
                            mEvents.Add(new SharpEntropy.TrainingEvent(Same, features.ToArray()));
                            discourseEntity = currentDiscourseEntity;
                            //System.err.println("MaxentResolver.retain: resolved at "+ei);
                            Distances.Add(entityIndex);
                        }
                        else if (!mPairedSampleSelection || (!nonReferentFound && useAsDifferentExample))
                        {
                            nonReferentFound = true;
                            mEvents.Add(new SharpEntropy.TrainingEvent(Diff, features.ToArray()));
                        }
                        //}
                    }
                    if (mPairedSampleSelection && referentFound && nonReferentFound)
                    {
                        break;
                    }
                    if (mPreferFirstReferent && referentFound)
                    {
                        break;
                    }
                }
                // doesn't refer to anything
                if (hasReferentialCandidate)
                {
                    mNonReferentialResolver.AddEvent(mention);
                }
                return discourseEntity;
            }
            else
            {
                return base.Retain(mention, discourseModel);
            }
        }
开发者ID:JJColeman,项目名称:jcoleman_Capstone,代码行数:79,代码来源:MaximumEntropyResolver.cs


注:本文中的Mention类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。