コード例 #1
0
ファイル: DiscourseEntity.cs プロジェクト: AndreyShp/StudyFun
 /// <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;
 }
コード例 #2
0
 /// <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;
 }
コード例 #3
0
 private GenderEnum GetGender(List <Context> entity)
 {
     foreach (Context entityContext in entity)
     {
         GenderEnum gender = GetGender(entityContext);
         if (gender != GenderEnum.Unknown)
         {
             return(gender);
         }
     }
     return(GenderEnum.Unknown);
 }
コード例 #4
0
        virtual public void SetExtents(Context[] extents)
        {
            var entities   = new Util.HashList <int, Context>();
            var singletons = new List <Context>();

            for (int currentExtent = 0; currentExtent < extents.Length; currentExtent++)
            {
                Context extent = extents[currentExtent];
                if (extent.Id != -1)
                {
                    entities.Put(extent.Id, extent);
                }
                else
                {
                    singletons.Add(extent);
                }
            }
            var males    = new List <Context>();
            var females  = new List <Context>();
            var eunuches = new List <Context>();

            //coref entities
            foreach (int key in entities.Keys)
            {
                List <Context> entityContexts = entities[key];
                GenderEnum     gender         = GetGender(entityContexts);
                if (gender != null)
                {
                    if (gender == GenderEnum.Male)
                    {
                        males.AddRange(entityContexts);
                    }
                    else if (gender == GenderEnum.Female)
                    {
                        females.AddRange(entityContexts);
                    }
                    else if (gender == GenderEnum.Neuter)
                    {
                        eunuches.AddRange(entityContexts);
                    }
                }
            }
            //non-coref entities
            foreach (Context entityContext in singletons)
            {
                GenderEnum gender = GetGender(entityContext);
                if (gender == GenderEnum.Male)
                {
                    males.Add(entityContext);
                }
                else if (gender == GenderEnum.Female)
                {
                    females.Add(entityContext);
                }
                else if (gender == GenderEnum.Neuter)
                {
                    eunuches.Add(entityContext);
                }
            }

            foreach (Context entityContext in males)
            {
                AddEvent(GenderEnum.Male.ToString(), entityContext);
            }

            foreach (Context entityContext in females)
            {
                AddEvent(GenderEnum.Female.ToString(), entityContext);
            }

            foreach (Context entityContext in eunuches)
            {
                AddEvent(GenderEnum.Neuter.ToString(), entityContext);
            }
        }
コード例 #5
0
        virtual public void SetExtents(Context[] extents)
        {
            Util.HashList <int, Context> entities = new Util.HashList <int, Context>();
            List <Context> singletons             = new List <Context>();

            for (int currentExtent = 0; currentExtent < extents.Length; currentExtent++)
            {
                Context extent = extents[currentExtent];
                //System.err.println("GenderModel.setExtents: ec("+ec.getId()+") "+ec.toText());
                if (extent.Id != -1)
                {
                    entities.Put(extent.Id, extent);
                }
                else
                {
                    singletons.Add(extent);
                }
            }
            List <Context> males    = new List <Context>();
            List <Context> females  = new List <Context>();
            List <Context> eunuches = new List <Context>();

            //coref entities
            foreach (int key in entities.Keys)
            {
                List <Context> entityContexts = entities[key];
                GenderEnum     gender         = GetGender(entityContexts);
                if (gender != null)
                {
                    if (gender == GenderEnum.Male)
                    {
                        males.AddRange(entityContexts);
                    }
                    else if (gender == GenderEnum.Female)
                    {
                        females.AddRange(entityContexts);
                    }
                    else if (gender == GenderEnum.Neuter)
                    {
                        eunuches.AddRange(entityContexts);
                    }
                }
            }
            //non-coref entities
            foreach (Context entityContext in singletons)
            {
                GenderEnum gender = GetGender(entityContext);
                if (gender == GenderEnum.Male)
                {
                    males.Add(entityContext);
                }
                else if (gender == GenderEnum.Female)
                {
                    females.Add(entityContext);
                }
                else if (gender == GenderEnum.Neuter)
                {
                    eunuches.Add(entityContext);
                }
            }

            foreach (Context entityContext in males)
            {
                AddEvent(GenderEnum.Male.ToString(), entityContext);
            }

            foreach (Context entityContext in females)
            {
                AddEvent(GenderEnum.Female.ToString(), entityContext);
            }

            foreach (Context entityContext in eunuches)
            {
                AddEvent(GenderEnum.Neuter.ToString(), entityContext);
            }
        }
コード例 #6
0
ファイル: Gender.cs プロジェクト: gblosser/OpenNlp
		public Gender(GenderEnum type, double confidence)
		{
			mType = type;
			mConfidence = confidence;
		}
コード例 #7
0
 /// <summary>
 /// Creates a new entity based on the specified mention.
 /// </summary>
 /// <param name="mention">
 /// The first mention of this entity.
 /// </param>
 public DiscourseEntity(Mention.MentionContext mention)
     : base(mention)
 {
     mGender = Similarity.GenderEnum.Unknown;
     mNumber = Similarity.NumberEnum.Unknown;
 }
コード例 #8
0
 public Gender(GenderEnum type, double confidence)
 {
     mType       = type;
     mConfidence = confidence;
 }
コード例 #9
0
ファイル: DiscourseEntity.cs プロジェクト: AndreyShp/StudyFun
 /// <summary>
 /// Creates a new entity based on the specified mention.
 /// </summary>
 /// <param name="mention">
 /// The first mention of this entity.
 /// </param>
 public DiscourseEntity(Mention.MentionContext mention) : base(mention)
 {
     mGender = Similarity.GenderEnum.Unknown;
     mNumber = Similarity.NumberEnum.Unknown;
 }