ocrd_cis/align/cli.py
def align_lines(self, lines):
        """align the given line alignment with the lines"""
        if not lines:
            return
        if len(lines[0].region.get_TextEquiv()) > 1:
            del lines[0].region.get_TextEquiv()[1:]
        for i, line in enumerate(lines):
            if lines[0].region.get_TextEquiv() is None:
                lines[0].region.TextEquiv = []
            self.log.debug('line alignment: %s [%s - %s]',
                          get_textequiv_unicode(line.region),
                          line.region.get_id(),
                          line.input_file.input_file_group)
            ddt = line.input_file.input_file_group + "/" + line.region.get_id()
            if i != 0:
                te = TextEquivType(
                    Unicode=get_textequiv_unicode(line.region),
                    conf=get_textequiv_conf(line.region),
                    dataType="ocrd-cis-line-alignment",
                    dataTypeDetails=ddt)
                lines[0].region.add_TextEquiv(te)
            else:
                self.log.debug("len: %i, i: %i", len(lines[0].region.get_TextEquiv()), i)
                lines[0].region.get_TextEquiv()[i].set_dataType(
                    "ocrd-cis-line-alignment-master-ocr")
            lines[0].region.get_TextEquiv()[i].set_dataTypeDetails(ddt)
            lines[0].region.get_TextEquiv()[i].set_index(i+1)
        self.align_words(lines)
align the given line alignment with the lines
align the given line alignment with the lines
align the given line alignment with the lines
def align_lines(self, lines):
        if not lines:
            return
        if len(lines[0].region.get_TextEquiv()) > 1:
            del lines[0].region.get_TextEquiv()[1:]
        for i, line in enumerate(lines):
            if lines[0].region.get_TextEquiv() is None:
                lines[0].region.TextEquiv = []
            self.log.debug('line alignment: %s [%s - %s]',
                          get_textequiv_unicode(line.region),
                          line.region.get_id(),
                          line.input_file.input_file_group)
            ddt = line.input_file.input_file_group + "/" + line.region.get_id()
            if i != 0:
                te = TextEquivType(
                    Unicode=get_textequiv_unicode(line.region),
                    conf=get_textequiv_conf(line.region),
                    dataType="ocrd-cis-line-alignment",
                    dataTypeDetails=ddt)
                lines[0].region.add_TextEquiv(te)
            else:
                self.log.debug("len: %i, i: %i", len(lines[0].region.get_TextEquiv()), i)
                lines[0].region.get_TextEquiv()[i].set_dataType(
                    "ocrd-cis-line-alignment-master-ocr")
            lines[0].region.get_TextEquiv()[i].set_dataTypeDetails(ddt)
            lines[0].region.get_TextEquiv()[i].set_index(i+1)
        self.align_words(lines)
def align_lines ( self , lines ) : if not lines : return if len ( lines [ 0 ] . region . get_TextEquiv ( ) ) > 1 : del lines [ 0 ] . region . get_TextEquiv ( ) [ 1 : ] for i , line in enumerate ( lines ) : if lines [ 0 ] . region . get_TextEquiv ( ) is None : lines [ 0 ] . region . TextEquiv = [ ] self . log . debug ( 'line alignment: %s [%s - %s]' , get_textequiv_unicode ( line . region ) , line . region . get_id ( ) , line . input_file . input_file_group ) ddt = line . input_file . input_file_group + "/" + line . region . get_id ( ) if i != 0 : te = TextEquivType ( Unicode = get_textequiv_unicode ( line . region ) , conf = get_textequiv_conf ( line . region ) , dataType = "ocrd-cis-line-alignment" , dataTypeDetails = ddt ) lines [ 0 ] . region . add_TextEquiv ( te ) else : self . log . debug ( "len: %i, i: %i" , len ( lines [ 0 ] . region . get_TextEquiv ( ) ) , i ) lines [ 0 ] . region . get_TextEquiv ( ) [ i ] . set_dataType ( "ocrd-cis-line-alignment-master-ocr" ) lines [ 0 ] . region . get_TextEquiv ( ) [ i ] . set_dataTypeDetails ( ddt ) lines [ 0 ] . region . get_TextEquiv ( ) [ i ] . set_index ( i + 1 ) self . align_words ( lines )
align the given line alignment with the lines
align the given line alignment with the lines
"""align the given line alignment with the lines"""
self
lines