Beispiel #1
0
        public override string ToXml(int offset)
        {
            StringBuilder buffer = new StringBuilder();

            AppendOffset(buffer, offset);
            buffer.Append("<relation_mention ID=\"" + GetId() + "\"");
            if (mLexicalCondition != null)
            {
                buffer.Append(" LEXICALCONDITION=\"" + mLexicalCondition + "\"");
            }
            buffer.Append(">\n");
            buffer.Append(mExtent.ToXml("extent", offset + 2));
            buffer.Append("\n");
            AceRelationMentionArgument arg1 = GetArgs()[0];
            AceRelationMentionArgument arg2 = GetArgs()[1];

            if (arg1.GetRole().Equals("Arg-1"))
            {
                // left to right
                buffer.Append(arg1.ToXml(offset + 2) + "\n");
                buffer.Append(arg2.ToXml(offset + 2) + "\n");
            }
            else
            {
                // right to left
                buffer.Append(arg2.ToXml(offset + 2) + "\n");
                buffer.Append(arg1.ToXml(offset + 2) + "\n");
            }
            AppendOffset(buffer, offset);
            buffer.Append("</relation_mention>");
            return(buffer.ToString());
        }
        public virtual string ToXml(int offset)
        {
            StringBuilder buffer = new StringBuilder();

            AppendOffset(buffer, offset);
            buffer.Append("<relation ID=\"" + GetId() + "\" TYPE =\"" + mType + "\" SUBTYPE=\"" + mSubtype + "\" MODALITY=\"" + mModality + "\" TENSE=\"" + mTense + "\">\n");
            AceRelationMentionArgument arg1 = mMentions[0].GetArgs()[0];
            AceRelationMentionArgument arg2 = mMentions[0].GetArgs()[1];

            if (arg1.GetRole().Equals("Arg-1"))
            {
                // left to right
                buffer.Append(arg1.ToXmlShort(offset + 2) + "\n");
                buffer.Append(arg2.ToXmlShort(offset + 2) + "\n");
            }
            else
            {
                // right to left
                buffer.Append(arg2.ToXmlShort(offset + 2) + "\n");
                buffer.Append(arg1.ToXmlShort(offset + 2) + "\n");
            }
            foreach (AceRelationMention m in mMentions)
            {
                buffer.Append(m.ToXml(offset + 2));
                buffer.Append("\n");
            }
            AppendOffset(buffer, offset);
            buffer.Append("</relation>");
            return(buffer.ToString());
        }
Beispiel #3
0
 public virtual void SetArg(int which, AceEntityMention em, string role)
 {
     mArguments[which] = new AceRelationMentionArgument(role, em);
 }