Exemplo n.º 1
0
        //UPGRADE_NOTE: Access modifiers of method 'excluded' were changed to 'public'. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1204'"
        protected internal override bool IsExcluded(MentionContext mention, DiscourseEntity entity)
        {
            if (base.IsExcluded(mention, entity))
            {
                return(true);
            }
            var cec = entity.LastExtent;

            if (!CanResolve(cec))
            {
                return(true);
            }
            if (PartsOfSpeech.IsProperNoun(mention.HeadTokenTag))
            {
                //mention is a propernoun
                if (PartsOfSpeech.IsProperNoun(cec.HeadTokenTag))
                {
                    return(true);                    // both NNP
                }
                else
                {
                    if (entity.MentionCount > 1)
                    {
                        return(true);
                    }
                    return(!CanResolve(cec));
                }
            }
            else if (PartsOfSpeech.IsPersOrPossPronoun(mention.HeadTokenTag))
            {
                // mention is a speech pronoun
                // cec can be either a speech pronoun or a propernoun
                if (PartsOfSpeech.IsProperNoun(cec.HeadTokenTag))
                {
                    //exclude antecedents not in the same sentence when they are not pronoun
                    return(mention.SentenceNumber - cec.SentenceNumber != 0);
                }
                else if (PartsOfSpeech.IsPersOrPossPronoun(cec.HeadTokenTag))
                {
                    return(false);
                }
                else
                {
                    Console.Error.WriteLine("Unexpected candidate exluded: " + cec.ToText());
                    return(true);
                }
            }
            else
            {
                Console.Error.WriteLine("Unexpected mention exluded: " + mention.ToText());
                return(true);
            }
        }
 //UPGRADE_NOTE: Access modifiers of method 'excluded' were changed to 'public'. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1204'"
 protected internal override bool IsExcluded(MentionContext mention, DiscourseEntity entity)
 {
     if (base.IsExcluded(mention, entity))
     {
         return true;
     }
     MentionContext cec = entity.LastExtent;
     if (!CanResolve(cec))
     {
         return true;
     }
     if (mention.HeadTokenTag.StartsWith("NNP"))
     {
         //mention is a propernoun
         if (cec.HeadTokenTag.StartsWith("NNP"))
         {
             return true; // both NNP
         }
         else
         {
             if (entity.MentionCount > 1)
             {
                 return true;
             }
             return !CanResolve(cec);
         }
     }
     else if (mention.HeadTokenTag.StartsWith("PRP"))
     {
         // mention is a speech pronoun
         // cec can be either a speech pronoun or a propernoun
         if (cec.HeadTokenTag.StartsWith("NNP"))
         {
             //exclude antecedents not in the same sentence when they are not pronoun
             return (mention.SentenceNumber - cec.SentenceNumber != 0);
         }
         else if (cec.HeadTokenTag.StartsWith("PRP"))
         {
             return false;
         }
         else
         {
             System.Console.Error.WriteLine("Unexpected candidate exluded: " + cec.ToText());
             return true;
         }
     }
     else
     {
         System.Console.Error.WriteLine("Unexpected mention exluded: " + mention.ToText());
         return true;
     }
 }