コード例 #1
0
ファイル: classify.py プロジェクト: alan0526/Gamera
    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)
コード例 #2
0
ファイル: core.py プロジェクト: alan0526/Gamera
 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.)
     """
     return gamera_xml.WriteXML(glyphs=[self]).write_filename(filename)
コード例 #3
0
def test_write_xml():
   glyphs = gamera_xml.glyphs_from_xml("data/testline.xml")
   writer = gamera_xml.WriteXML(glyphs)
   result_string = writer.string()
   writer.write_filename("tmp/testline_test3.xml")
   assert equal_files("tmp/testline_test3.xml", "data/testline_test3.xml")
コード例 #4
0
ファイル: core.py プロジェクト: alan0526/Gamera
 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.)
     """
     return gamera_xml.WriteXML(glyphs=[self]).write_stream(stream)