Ejemplo n.º 1
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;
 }
Ejemplo n.º 2
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 extentIndex = 0; extentIndex < extents.Length; extentIndex++)
            {
                Context currentExtent = extents[extentIndex];
                //System.err.println("NumberModel.setExtents: ec("+ec.getId()+") "+ec.toText());
                if (currentExtent.Id != -1)
                {
                    entities.Put(currentExtent.Id, currentExtent);
                }
                else
                {
                    singletons.Add(currentExtent);
                }
            }
            List <Context> singles = new List <Context>();
            List <Context> plurals = new List <Context>();

            // coref entities
            foreach (int key in entities.Keys)
            {
                List <Context> entityContexts = entities[key];
                NumberEnum     number         = GetNumber(entityContexts);
                if (number == NumberEnum.Singular)
                {
                    singles.AddRange(entityContexts);
                }
                else if (number == NumberEnum.Plural)
                {
                    plurals.AddRange(entityContexts);
                }
            }
            // non-coref entities.
            foreach (Context currentContext in singletons)
            {
                NumberEnum number = GetNumber(currentContext);
                if (number == NumberEnum.Singular)
                {
                    singles.Add(currentContext);
                }
                else if (number == NumberEnum.Plural)
                {
                    plurals.Add(currentContext);
                }
            }

            foreach (Context currentContext in singles)
            {
                AddEvent(NumberEnum.Singular.ToString(), currentContext);
            }

            foreach (Context currentContext in plurals)
            {
                AddEvent(NumberEnum.Plural.ToString(), currentContext);
            }
        }
Ejemplo n.º 3
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;
 }
Ejemplo n.º 4
0
 private NumberEnum GetNumber(List <Context> entity)
 {
     foreach (Context currentContext in entity)
     {
         NumberEnum number = GetNumber(currentContext);
         if (number != NumberEnum.Unknown)
         {
             return(number);
         }
     }
     return(NumberEnum.Unknown);
 }
Ejemplo n.º 5
0
 public Number(NumberEnum type, double confidence)
 {
     mType       = type;
     mConfidence = confidence;
 }
Ejemplo n.º 6
0
 public Number(NumberEnum type, double confidence)
 {
     mType = type;
     mConfidence = confidence;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 8
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;
 }