ocrd_cis/align/cli.py
def align(self, alignments, ift):
        """align the alignment objects with the according input file tuples"""
        for t in ift:
            self.log.debug("tuple %s", os.path.basename(t.input_file.url))
        pcgtst = self.open_input_file_tuples(ift)
        i = 0
        for mi, mr in enumerate(pcgtst[0].get_Page().get_TextRegion()):
            for mj, _ in enumerate(mr.get_TextLine()):
                for iiii, u in enumerate(mr.get_TextLine()[mj].get_TextEquiv()):
                    self.log.debug("[%d] %s", iiii, u.Unicode)
                for xx in mr.get_TextLine()[mj].get_Word():
                    for iiii, u in enumerate(xx.get_TextEquiv()):
                        self.log.debug("[%d] %s", iiii, u.Unicode)

                lines = []
                for ii, t in enumerate(ift):
                    if i >= len(alignments):
                        break
                    tr = pcgtst[ii].get_Page().get_TextRegion()
                    region = tr[mi].get_TextLine()[mj]
                    lines.append(Alignment(t, region, alignments[i]))
                self.align_lines(lines)
                i += 1
        return pcgtst[0]
align the alignment objects with the according input file tuples
align the alignment objects with the according input file tuples
align the alignment objects with the according input file tuples
def align(self, alignments, ift):
        for t in ift:
            self.log.debug("tuple %s", os.path.basename(t.input_file.url))
        pcgtst = self.open_input_file_tuples(ift)
        i = 0
        for mi, mr in enumerate(pcgtst[0].get_Page().get_TextRegion()):
            for mj, _ in enumerate(mr.get_TextLine()):
                for iiii, u in enumerate(mr.get_TextLine()[mj].get_TextEquiv()):
                    self.log.debug("[%d] %s", iiii, u.Unicode)
                for xx in mr.get_TextLine()[mj].get_Word():
                    for iiii, u in enumerate(xx.get_TextEquiv()):
                        self.log.debug("[%d] %s", iiii, u.Unicode)
                lines = []
                for ii, t in enumerate(ift):
                    if i >= len(alignments):
                        break
                    tr = pcgtst[ii].get_Page().get_TextRegion()
                    region = tr[mi].get_TextLine()[mj]
                    lines.append(Alignment(t, region, alignments[i]))
                self.align_lines(lines)
                i += 1
        return pcgtst[0]
def align ( self , alignments , ift ) : for t in ift : self . log . debug ( "tuple %s" , os . path . basename ( t . input_file . url ) ) pcgtst = self . open_input_file_tuples ( ift ) i = 0 for mi , mr in enumerate ( pcgtst [ 0 ] . get_Page ( ) . get_TextRegion ( ) ) : for mj , _ in enumerate ( mr . get_TextLine ( ) ) : for iiii , u in enumerate ( mr . get_TextLine ( ) [ mj ] . get_TextEquiv ( ) ) : self . log . debug ( "[%d] %s" , iiii , u . Unicode ) for xx in mr . get_TextLine ( ) [ mj ] . get_Word ( ) : for iiii , u in enumerate ( xx . get_TextEquiv ( ) ) : self . log . debug ( "[%d] %s" , iiii , u . Unicode ) lines = [ ] for ii , t in enumerate ( ift ) : if i >= len ( alignments ) : break tr = pcgtst [ ii ] . get_Page ( ) . get_TextRegion ( ) region = tr [ mi ] . get_TextLine ( ) [ mj ] lines . append ( Alignment ( t , region , alignments [ i ] ) ) self . align_lines ( lines ) i += 1 return pcgtst [ 0 ]
align the alignment objects with the according input file tuples
align the alignment objects with the according input file tuples
"""align the alignment objects with the according input file tuples"""
self
alignments
ift