コード例 #1
0
ファイル: core.py プロジェクト: playingaround2017/test123
 def to_xml_filename(self, filename):
     """
   Saves the Gamera XML representation of the image to the given *filename*.
   (See the Gamera XML DTD in ``misc/gamera.dtd`` in the source distribution.)
   """
     import gamera_xml
     return gamera_xml.WriteXML(glyphs=[self]).write_filename(filename)
コード例 #2
0
ファイル: core.py プロジェクト: playingaround2017/test123
 def to_xml(self, stream=None):
     """
   Returns a string containing the Gamera XML representation of the image.
   (See the Gamera XML DTD in ``misc/gamera.dtd`` in the source distribution.)
   """
     import gamera_xml
     return gamera_xml.WriteXML(glyphs=[self]).write_stream(stream)
コード例 #3
0
   def to_xml(self, stream, with_features=True):
      """**to_xml** (stream *stream*)

Saves the training data in XML format to the given stream (which could
be any object supporting the file protocol, such as a file object or StringIO
object)."""
      self.is_dirty = False
      glyphs = [g for g in self.get_glyphs() 
                if not g.get_main_id().startswith("_group._part")]
      return gamera_xml.WriteXML(
         glyphs=glyphs, with_features=with_features).write_stream(stream)