本文整理汇总了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;
}
}
示例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;
}
}
示例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;
}
}