示例#1
0
		/// <summary>
        /// Updates the specified discourse model with the specified mention as coreferent with the specified entity. 
        /// </summary>
		/// <param name="discourseModel">
        /// The discourse model
		/// </param>
		/// <param name="mention">
        /// The mention to be added to the specified entity.
		/// </param>
		/// <param name="entity">
        /// The entity which is mentioned by the specified mention.  
		/// </param>
		/// <param name="useDiscourseModel">
        /// Whether the mentions should be kept as an entiy or simply co-indexed.
		/// </param>
		protected internal virtual void UpdateExtent(DiscourseModel discourseModel, MentionContext mention, DiscourseEntity entity, bool useDiscourseModel)
		{
			if (useDiscourseModel)
			{
				if (entity != null)
				{
					if (entity.GenderProbability < mention.GenderProbability)
					{
						entity.Gender = mention.GetGender();
						entity.GenderProbability = mention.GenderProbability;
					}
					if (entity.NumberProbability < mention.NumberProbability)
					{
						entity.Number = mention.GetNumber();
						entity.NumberProbability = mention.NumberProbability;
					}
					entity.AddMention(mention);
					discourseModel.MentionEntity(entity);
				}
				else
				{
					entity = new DiscourseEntity(mention, mention.GetGender(), mention.GenderProbability, mention.GetNumber(), mention.NumberProbability);
					discourseModel.AddEntity(entity);
				}
			}
			else
			{
				if (entity != null)
				{
					var newEntity = new DiscourseEntity(mention, mention.GetGender(), mention.GenderProbability, mention.GetNumber(), mention.NumberProbability);
					discourseModel.AddEntity(newEntity);
					newEntity.Id = entity.Id;
				}
				else
				{
					var newEntity = new DiscourseEntity(mention, mention.GetGender(), mention.GenderProbability, mention.GetNumber(), mention.NumberProbability);
					discourseModel.AddEntity(newEntity);
				}
			}
		}
 /// <summary>
 /// Updates the specified discourse model with the specified mention as coreferent with the specified entity. 
 /// </summary>
 /// <param name="discourseModel">
 /// The discourse model
 /// </param>
 /// <param name="mention">
 /// The mention to be added to the specified entity.
 /// </param>
 /// <param name="entity">
 /// The entity which is mentioned by the specified mention.  
 /// </param>
 /// <param name="useDiscourseModel">
 /// Whether the mentions should be kept as an entiy or simply co-indexed.
 /// </param>
 protected internal virtual void UpdateExtent(DiscourseModel discourseModel, MentionContext mention, DiscourseEntity entity, bool useDiscourseModel)
 {
     if (useDiscourseModel)
     {
         if (entity != null)
         {
             //System.err.println("AbstractLinker.updateExtent: addingExtent:
             // "+econtext.toText());
             if (entity.GenderProbability < mention.GenderProbability)
             {
                 entity.Gender = mention.GetGender();
                 entity.GenderProbability = mention.GenderProbability;
             }
             if (entity.NumberProbability < mention.NumberProbability)
             {
                 entity.Number = mention.GetNumber();
                 entity.NumberProbability = mention.NumberProbability;
             }
             entity.AddMention(mention);
             discourseModel.MentionEntity(entity);
         }
         else
         {
             //System.err.println("AbstractLinker.updateExtent: creatingExtent:
             // "+econtext.toText()+" "+econtext.gender+" "+econtext.number);
             entity = new DiscourseEntity(mention, mention.GetGender(), mention.GenderProbability, mention.GetNumber(), mention.NumberProbability);
             discourseModel.AddEntity(entity);
         }
     }
     else
     {
         if (entity != null)
         {
             DiscourseEntity newEntity = new DiscourseEntity(mention, mention.GetGender(), mention.GenderProbability, mention.GetNumber(), mention.NumberProbability);
             discourseModel.AddEntity(newEntity);
             newEntity.Id = entity.Id;
         }
         else
         {
             DiscourseEntity newEntity = new DiscourseEntity(mention, mention.GetGender(), mention.GenderProbability, mention.GetNumber(), mention.NumberProbability);
             discourseModel.AddEntity(newEntity);
         }
     }
     //System.err.println(de1);
 }