private void ManageNotFoundArg(CGRelation item)
 {
     item.description = "arg not found in propbank";
     if (item.label == "ARG0")
     {
         item.f = "pag";
         item.conceptualrole = "agent";
     }
     else if (item.label == "ARG1")
     {
         item.f = "ppt";
         item.conceptualrole = "patient";
     }
     else if (item.label == "ARG2")
     {
         item.f = "g";
         item.conceptualrole = "goal";
     }
     else if (item.label == "ARG3")
     {
         item.f = "start";
         item.conceptualrole = "start";
     }
     else if (item.label == "ARG4")
     {
         item.f = "end";
         item.conceptualrole = "end";
     }
     else
     {
         item.f              = item.label;
         item.description    = item.label;
         item.conceptualrole = item.label;
     }
 }
示例#2
0
        public void ReadAMR(AMRDocument Document)
        {
            foreach (var gr in Document.Graphs)
            {
                for (int i = 0; i < gr.Nodes.Count; i++)
                {
                    var node = gr.Nodes.ElementAt(i);
                    var g    = new CGNode(node, gr.name);
                    if (i == 0)
                    {
                        g.AddSemanticRole("root");
                    }
                    this.AddNode(g);
                }
                //transform relations
                foreach (var relation in gr.Relations)
                {
                    var head = gr.Nodes.Where(c => c.name == relation.Head).First();
                    var tail = gr.Nodes.Where(c => c.name == relation.Tail).First();
                    relation.Head = head.id;
                    relation.Tail = tail.id;

                    var rel = new CGRelation(relation);
                    this.AddRelation(rel);
                }
            }
        }
示例#3
0
        public void AddRelation(CGRelation relation)
        {
            var exists = this._Relations.Where(c => c.Head == relation.Head && c.Tail == relation.Tail && c.f == relation.f).FirstOrDefault();

            if (exists != null)
            {
                exists.ocurrences += 1;
            }
            else
            {
                this._Relations.Add(relation);
            }
        }
示例#4
0
        public CGRelation Clone()
        {
            var rel = new CGRelation();

            rel.Head           = this.Head;
            rel.Tail           = this.Tail;
            rel.label          = this.label;
            rel.vncls          = this.vncls;
            rel.vntheta        = this.vntheta;
            rel.description    = this.description;
            rel.conceptualrole = this.conceptualrole;
            rel.f = this.f;
            return(rel);
        }
示例#5
0
 public void RemoveRelation(CGRelation relation)
 {
     this._Relations.Remove(relation);
 }