Esempio 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)
 {
     Gender            = gender;
     GenderProbability = genderProbability;
     Number            = number;
     NumberProbability = numberProbability;
 }
Esempio n. 2
0
 private string GetNumberCompatibilityFeature(Mention.MentionContext entityContext, DiscourseEntity discourseEntity)
 {
     Similarity.NumberEnum entityNumber = discourseEntity.Number;
     if (entityNumber == Similarity.NumberEnum.Unknown || entityContext.GetNumber() == Similarity.NumberEnum.Unknown)
     {
         return(mNumberUnknown);
     }
     else if (entityContext.GetNumber() == entityNumber)
     {
         return(mNumberCompatible);
     }
     else
     {
         return(mNumberIncompatible);
     }
 }
        public MentionContext(Util.Span span, Util.Span headSpan, int entityId, IParse parse, string extentType, string nameType, int mentionIndex, int mentionsInSentence, int mentionIndexInDocument, int sentenceIndex, IHeadFinder headFinder) : base(span, headSpan, entityId, parse, extentType, nameType, headFinder)
        {
            mNounLocation    = mentionIndex;
            mMaxNounLocation = mentionsInSentence;
            mNounNumber      = mentionIndexInDocument;
            mSentenceNumber  = sentenceIndex;
            mIndexSpan       = parse.Span;
            mPreviousToken   = parse.PreviousToken;
            mNextToken       = parse.NextToken;
            mHead            = headFinder.GetLastHead(parse);
            List <IParse> headTokens = mHead.Tokens;

            Tokens          = headTokens.ToArray();
            mBasalNextToken = mHead.NextToken;
            //System.err.println("MentionContext.init: "+ent+" "+ent.getEntityId()+" head="+head);
            //mNonDescriptorStart = 0;
            InitializeHeads(headFinder.GetHeadIndex(mHead));
            mGender            = Similarity.GenderEnum.Unknown;
            mGenderProbability = 0d;
            mNumber            = Similarity.NumberEnum.Unknown;
            mNumberProbability = 0d;
        }
Esempio n. 4
0
        public MentionContext(Util.Span span, Util.Span headSpan, int entityId, IParse parse, string extentType, string nameType,
                              int mentionIndex, int mentionsInSentence, int mentionIndexInDocument, int sentenceIndex, IHeadFinder headFinder) :
            base(span, headSpan, entityId, parse, extentType, nameType, headFinder)
        {
            NounPhraseSentenceIndex    = mentionIndex;
            MaxNounPhraseSentenceIndex = mentionsInSentence;
            NounPhraseDocumentIndex    = mentionIndexInDocument;
            SentenceNumber             = sentenceIndex;
            IndexSpan     = parse.Span;
            PreviousToken = parse.PreviousToken;
            NextToken     = parse.NextToken;
            Head          = headFinder.GetLastHead(parse);
            List <IParse> headTokens = Head.Tokens;

            Tokens         = headTokens.ToArray();
            NextTokenBasal = Head.NextToken;
            //mNonDescriptorStart = 0;
            InitializeHeads(headFinder.GetHeadIndex(Head));
            mGender           = Similarity.GenderEnum.Unknown;
            GenderProbability = 0d;
            _number           = Similarity.NumberEnum.Unknown;
            NumberProbability = 0d;
        }
Esempio n. 5
0
 /// <summary>
 /// Assigns the specified number with the specified probability to this mention.
 /// </summary>
 /// <param name="number">
 /// The number to be given to this mention.
 /// </param>
 /// <param name="probability">
 /// The probability assosicated with the number assignment.
 /// </param>
 public virtual void SetNumber(Similarity.NumberEnum number, double probability)
 {
     _number           = number;
     NumberProbability = probability;
 }
 /// <summary> 
 /// Assigns the specified number with the specified probability to this mention.
 /// </summary>
 /// <param name="number">
 /// The number to be given to this mention.
 /// </param>
 /// <param name="probability">
 /// The probability assosicated with the number assignment.
 /// </param>
 public virtual void SetNumber(Similarity.NumberEnum number, double probability)
 {
     mNumber = number;
     mNumberProbability = probability;
 }
 public MentionContext(Util.Span span, Util.Span headSpan, int entityId, IParse parse, string extentType, string nameType, int mentionIndex, int mentionsInSentence, int mentionIndexInDocument, int sentenceIndex, IHeadFinder headFinder)
     : base(span, headSpan, entityId, parse, extentType, nameType, headFinder)
 {
     mNounLocation = mentionIndex;
     mMaxNounLocation = mentionsInSentence;
     mNounNumber = mentionIndexInDocument;
     mSentenceNumber = sentenceIndex;
     mIndexSpan = parse.Span;
     mPreviousToken = parse.PreviousToken;
     mNextToken = parse.NextToken;
     mHead = headFinder.GetLastHead(parse);
     List<IParse> headTokens = mHead.Tokens;
     Tokens = headTokens.ToArray();
     mBasalNextToken = mHead.NextToken;
     //System.err.println("MentionContext.init: "+ent+" "+ent.getEntityId()+" head="+head);
     //mNonDescriptorStart = 0;
     InitializeHeads(headFinder.GetHeadIndex(mHead));
     mGender = Similarity.GenderEnum.Unknown;
     mGenderProbability = 0d;
     mNumber = Similarity.NumberEnum.Unknown;
     mNumberProbability = 0d;
 }
Esempio n. 8
0
        public MentionContext(Util.Span span, Util.Span headSpan, int entityId, IParse parse, string extentType, string nameType, 
            int mentionIndex, int mentionsInSentence, int mentionIndexInDocument, int sentenceIndex, IHeadFinder headFinder): 
            base(span, headSpan, entityId, parse, extentType, nameType, headFinder)
		{
            NounPhraseSentenceIndex = mentionIndex;
            MaxNounPhraseSentenceIndex = mentionsInSentence;
            NounPhraseDocumentIndex = mentionIndexInDocument;
			SentenceNumber = sentenceIndex;
			IndexSpan = parse.Span;
			PreviousToken = parse.PreviousToken;
			NextToken = parse.NextToken;
			Head = headFinder.GetLastHead(parse);
			List<IParse> headTokens = Head.Tokens;
            Tokens = headTokens.ToArray();
			NextTokenBasal = Head.NextToken;
			//mNonDescriptorStart = 0;
			InitializeHeads(headFinder.GetHeadIndex(Head));
            mGender = Similarity.GenderEnum.Unknown;
			GenderProbability = 0d;
            _number = Similarity.NumberEnum.Unknown;
			NumberProbability = 0d;
		}