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


C# Mention.GetGender方法代码示例

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


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

示例1: GetGenderCompatibilityFeature

 private string GetGenderCompatibilityFeature(Mention.MentionContext entityContext, DiscourseEntity discourseEntity)
 {
     Similarity.GenderEnum entityGender = discourseEntity.Gender;
     //System.err.println("getGenderCompatibility: mention="+ec.getGender()+" entity="+eg);
     if (entityGender == Similarity.GenderEnum.Unknown || entityContext.GetGender() == Similarity.GenderEnum.Unknown)
     {
         return mGenderUnknown;
     }
     else if (entityContext.GetGender() == entityGender)
     {
         return mGenderCompatible;
     }
     else
     {
         return mGenderIncompatible;
     }
 }
开发者ID:JJColeman,项目名称:jcoleman_Capstone,代码行数:17,代码来源:MaximumEntropyResolver.cs

示例2: Resolve

        public override DiscourseEntity Resolve(Mention.MentionContext expression, DiscourseModel discourseModel)
        {
            DiscourseEntity discourseEntity;
            int entityIndex = 0;
            double nonReferentialProbability = mNonReferentialResolver.GetNonReferentialProbability(expression);
            if (mDebugOn)
            {
                System.Console.Error.WriteLine(this.ToString() + ".resolve: " + expression.ToText() + " -> " + "null " + nonReferentialProbability);
            }
            for (; entityIndex < GetNumberEntitiesBack(discourseModel); entityIndex++)
            {
                discourseEntity = discourseModel.GetEntity(entityIndex);
                if (IsOutOfRange(expression, discourseEntity))
                {
                    break;
                }
                if (IsExcluded(expression, discourseEntity))
                {
                    mCandidateProbabilities[entityIndex] = 0;
                    if (mDebugOn)
                    {
                        System.Console.Error.WriteLine("excluded " + this.ToString() + ".resolve: " + expression.ToText() + " -> " + discourseEntity + " " + mCandidateProbabilities[entityIndex]);
                    }
                }
                else
                {
                    string[] features = GetFeatures(expression, discourseEntity).ToArray();
                    try
                    {
                        mCandidateProbabilities[entityIndex] = mModel.Evaluate(features)[mSameIndex];
                    }
                    catch (System.IndexOutOfRangeException e)
                    {
                        mCandidateProbabilities[entityIndex] = 0;
                    }
                    if (mDebugOn)
                    {
                        System.Console.Error.WriteLine(this + ".resolve: " + expression.ToText() + " -> " + discourseEntity + " (" + expression.GetGender() + "," + discourseEntity.Gender + ") " + mCandidateProbabilities[entityIndex] + " " + string.Join(",", features)); //SupportClass.CollectionToString(lfeatures));
                    }
                }
                if (mPreferFirstReferent && mCandidateProbabilities[entityIndex] > nonReferentialProbability)
                {
                    entityIndex++; //update for nonRef assignment
                    break;
                }
            }
            mCandidateProbabilities[entityIndex] = nonReferentialProbability;

            // find max
            int maximumCandidateIndex = 0;
            for (int currentCandidate = 1; currentCandidate <= entityIndex; currentCandidate++)
            {
                if (mCandidateProbabilities[currentCandidate] > mCandidateProbabilities[maximumCandidateIndex])
                {
                    maximumCandidateIndex = currentCandidate;
                }
            }
            if (maximumCandidateIndex == entityIndex)
            {
                // no referent
                return null;
            }
            else
            {
                discourseEntity = discourseModel.GetEntity(maximumCandidateIndex);
                return discourseEntity;
            }
        }
开发者ID:JJColeman,项目名称:jcoleman_Capstone,代码行数:68,代码来源:MaximumEntropyResolver.cs

示例3: GetGenderCompatibilityFeature

        private string GetGenderCompatibilityFeature(Mention.MentionContext entityContext, DiscourseEntity discourseEntity)
		{
            Similarity.GenderEnum entityGender = discourseEntity.Gender;
            if (entityGender == Similarity.GenderEnum.Unknown || entityContext.GetGender() == Similarity.GenderEnum.Unknown)
			{
				return GenderUnknown;
			}
			else if (entityContext.GetGender() == entityGender)
			{
				return GenderCompatible;
			}
			else
			{
				return GenderIncompatible;
			}
		}
开发者ID:gblosser,项目名称:OpenNlp,代码行数:16,代码来源:MaximumEntropyResolver.cs


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