• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Mention类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: ExcludedHonorificMentionString

 private string ExcludedHonorificMentionString(Mention.MentionContext entityContext)
 {
     System.Text.StringBuilder output = new System.Text.StringBuilder();
     bool first = true;
     object[] mentionTokens = entityContext.Tokens;
     for (int tokenIndex = 0; tokenIndex < mentionTokens.Length; tokenIndex++)
     {
         string token = mentionTokens[tokenIndex].ToString();
         if (!(Linker.HonorificsPattern.Match(token).Value == token))
         {
             if (!first)
             {
                 output.Append(" ");
             }
             output.Append(token);
             first = false;
         }
     }
     return output.ToString();
 }
开发者ID:JJColeman,项目名称:jcoleman_Capstone,代码行数:20,代码来源:MaximumEntropyResolver.cs


示例17: ExcludedTheMentionString

 private string ExcludedTheMentionString(Mention.MentionContext entityContext)
 {
     System.Text.StringBuilder output = new System.Text.StringBuilder();
     bool first = true;
     object[] mentionTokens = entityContext.Tokens;
     for (int tokenIndex = 0; tokenIndex < mentionTokens.Length; tokenIndex++)
     {
         string token = mentionTokens[tokenIndex].ToString();
         if (token != "the" && token != "The" && token != "THE")
         {
             if (!first)
             {
                 output.Append(" ");
             }
             output.Append(token);
             first = false;
         }
     }
     return output.ToString();
 }
开发者ID:JJColeman,项目名称:jcoleman_Capstone,代码行数:20,代码来源:MaximumEntropyResolver.cs


示例18: GetDistanceFeatures

 /// <summary>
 /// Returns distance features for the specified mention and entity.
 /// </summary>
 /// <param name="mention">
 /// The mention.
 /// </param>
 /// <param name="entity">
 /// The entity.
 /// </param>
 /// <returns>
 /// list of distance features for the specified mention and entity.
 /// </returns>
 protected internal virtual List<string> GetDistanceFeatures(Mention.MentionContext mention, DiscourseEntity entity)
 {
     List<string> features = new List<string>();
     Mention.MentionContext currentEntityContext = entity.LastExtent;
     int entityDistance = mention.NounPhraseDocumentIndex - currentEntityContext.NounPhraseDocumentIndex;
     int sentenceDistance = mention.SentenceNumber - currentEntityContext.SentenceNumber;
     int hobbsEntityDistance;
     if (sentenceDistance == 0)
     {
         hobbsEntityDistance = currentEntityContext.NounPhraseSentenceIndex;
     }
     else
     {
         //hobbsEntityDistance = entityDistance - (entities within sentence from mention to end) + (entities within sentence form start to mention)
         //hobbsEntityDistance = entityDistance - (cec.maxNounLocation - cec.getNounPhraseSentenceIndex) + cec.getNounPhraseSentenceIndex;
         hobbsEntityDistance = entityDistance + (2 * currentEntityContext.NounPhraseSentenceIndex) - currentEntityContext.MaxNounPhraseSentenceIndex;
     }
     features.Add("hd=" + hobbsEntityDistance);
     features.Add("de=" + entityDistance);
     features.Add("ds=" + sentenceDistance);
     //features.add("ds=" + sdist + pronoun);
     //features.add("dn=" + cec.sentenceNumber);
     //features.add("ep=" + cec.nounLocation);
     return features;
 }
开发者ID:JJColeman,项目名称:jcoleman_Capstone,代码行数:37,代码来源:MaximumEntropyResolver.cs


示例19: GetExactMatchFeature

 private string GetExactMatchFeature(Mention.MentionContext entityContext, Mention.MentionContext compareContext)
 {
     //System.err.println("getExactMatchFeature: ec="+mentionString(ec)+" mc="+mentionString(xec));
     if (MentionString(entityContext).Equals(MentionString(compareContext)))
     {
         return "exactMatch";
     }
     else if (ExcludedHonorificMentionString(entityContext).Equals(ExcludedHonorificMentionString(compareContext)))
     {
         return "exactMatchNoHonor";
     }
     else if (ExcludedTheMentionString(entityContext).Equals(ExcludedTheMentionString(compareContext)))
     {
         return "exactMatchNoThe";
     }
     else if (ExcludedDeterminerMentionString(entityContext).Equals(ExcludedDeterminerMentionString(compareContext)))
     {
         return "exactMatchNoDT";
     }
     return null;
 }
开发者ID:JJColeman,项目名称:jcoleman_Capstone,代码行数:21,代码来源:MaximumEntropyResolver.cs


示例20: GetFeatures

 /// <summary>
 /// Returns a list of features for deciding whether the specified mention refers to the specified discourse entity.
 /// </summary>
 /// <param name="mention">
 /// the mention being considers as possibly referential. 
 /// </param>
 /// <param name="entity">
 /// The discourse entity with which the mention is being considered referential.  
 /// </param>
 /// <returns>
 /// a list of features used to predict reference between the specified mention and entity.
 /// </returns>
 protected internal virtual List<string> GetFeatures(Mention.MentionContext mention, DiscourseEntity entity)
 {
     List<string> features = new List<string>();
     features.Add(Default);
     features.AddRange(GetCompatibilityFeatures(mention, entity));
     return features;
 }
开发者ID:JJColeman,项目名称:jcoleman_Capstone,代码行数:19,代码来源:MaximumEntropyResolver.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Menu类代码示例发布时间:2022-05-24
下一篇:
C# MemoryStream类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap