private static Element ToXML(EntityMention entity, string curNS) { Element top = new Element("entity", curNS); top.AddAttribute(new Attribute("id", entity.GetObjectId())); Element type = new Element("type", curNS); type.AppendChild(entity.GetType()); top.AppendChild(entity.GetType()); if (entity.GetNormalizedName() != null) { Element nm = new Element("normalized", curNS); nm.AppendChild(entity.GetNormalizedName()); top.AppendChild(nm); } if (entity.GetSubType() != null) { Element subtype = new Element("subtype", curNS); subtype.AppendChild(entity.GetSubType()); top.AppendChild(subtype); } Element span = new Element("span", curNS); span.AddAttribute(new Attribute("start", int.ToString(entity.GetHeadTokenStart()))); span.AddAttribute(new Attribute("end", int.ToString(entity.GetHeadTokenEnd()))); top.AppendChild(span); top.AppendChild(MakeProbabilitiesElement(entity, curNS)); return(top); }