Пример #1
0
 public override bool Equals(object o)
 {
     if (this == o)
     {
         return(true);
     }
     if (!(o is Edu.Stanford.Nlp.IE.Machinereading.Structure.EventMention))
     {
         return(false);
     }
     if (!base.Equals(o))
     {
         return(false);
     }
     Edu.Stanford.Nlp.IE.Machinereading.Structure.EventMention that = (Edu.Stanford.Nlp.IE.Machinereading.Structure.EventMention)o;
     if (anchor != null ? !anchor.Equals(that.anchor) : that.anchor != null)
     {
         return(false);
     }
     if (eventModification != null ? !eventModification.Equals(that.eventModification) : that.eventModification != null)
     {
         return(false);
     }
     if (parents != null ? !parents.Equals(that.parents) : that.parents != null)
     {
         return(false);
     }
     return(true);
 }
Пример #2
0
 public virtual bool Contains(Edu.Stanford.Nlp.IE.Machinereading.Structure.EventMention e)
 {
     if (this == e)
     {
         return(true);
     }
     foreach (ExtractionObject a in GetArgs())
     {
         if (a is Edu.Stanford.Nlp.IE.Machinereading.Structure.EventMention)
         {
             Edu.Stanford.Nlp.IE.Machinereading.Structure.EventMention ea = (Edu.Stanford.Nlp.IE.Machinereading.Structure.EventMention)a;
             if (ea.Contains(e))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Пример #3
0
        public virtual void MergeEvent(Edu.Stanford.Nlp.IE.Machinereading.Structure.EventMention e, bool discardSameArgDifferentName)
        {
            // merge types if necessary
            string oldType = type;

            type = ExtractionObject.ConcatenateTypes(type, e.GetType());
            if (!type.Equals(oldType))
            {
                // This is not important: we use anchor types in the parser, not event types
                // This is done just for completeness of code
                logger.Fine("Type changed from " + oldType + " to " + type + " during check 3 merge.");
            }
            // add e's arguments
            for (int i = 0; i < e.GetArgs().Count; i++)
            {
                ExtractionObject a  = e.GetArg(i);
                string           an = e.GetArgNames()[i];
                // TODO: we might need more complex cycle detection than just contains()...
                if (a is Edu.Stanford.Nlp.IE.Machinereading.Structure.EventMention && ((Edu.Stanford.Nlp.IE.Machinereading.Structure.EventMention)a).Contains(this))
                {
                    logger.Info("Found event cycle during merge between e1 " + this + " and e2 " + e);
                }
                else
                {
                    // remove e from a's parents
                    if (a is Edu.Stanford.Nlp.IE.Machinereading.Structure.EventMention)
                    {
                        ((Edu.Stanford.Nlp.IE.Machinereading.Structure.EventMention)a).RemoveParent(e);
                    }
                    // add a as an arg to this
                    AddArg(a, an, discardSameArgDifferentName);
                }
            }
            // remove e's arguments. they are now attached to this, so we don't want them moved around during removeEvents
            e.ResetArguments();
            // remove e from its parent(s) to avoid using this argument in other merges of the parent
            e.RemoveFromParents();
        }
Пример #4
0
 public virtual void AddParent(Edu.Stanford.Nlp.IE.Machinereading.Structure.EventMention p)
 {
     parents.Add(p);
 }