ocrd_cis/align/cli.py
def match_tokens_lambda(self, tokens, regions, i, f):
        """
        Returns one after the last index of the match starting from i.
        Returns 0 if nothing could be matched.
        """
        for j, token in enumerate(tokens):
            if j + i >= len(regions):
                return 0
            if not regions[i+j].get_TextEquiv()[0].Unicode:
                self.log.warn("cannot find %s", token)
                return 0
            self.log.debug('checking %s with %s', token,
                           regions[i+j].get_TextEquiv()[0].Unicode)
            if f(token, regions[i+j].get_TextEquiv()[0].Unicode):
                continue
            if j == 0:
                return 0
            # skip this and try next one
            # if we already have found a
            # match ath the first token position
            i += 1
        return i + len(tokens)

        Returns one after the last index of the match starting from i.
        Returns 0 if nothing could be matched.
        
Returns one after the last index of the match starting from i.
Returns 0 if nothing could be matched.
Returns one after the last index of the match starting from i . Returns 0 if nothing could be matched .
def match_tokens_lambda(self, tokens, regions, i, f):
        for j, token in enumerate(tokens):
            if j + i >= len(regions):
                return 0
            if not regions[i+j].get_TextEquiv()[0].Unicode:
                self.log.warn("cannot find %s", token)
                return 0
            self.log.debug('checking %s with %s', token,
                           regions[i+j].get_TextEquiv()[0].Unicode)
            if f(token, regions[i+j].get_TextEquiv()[0].Unicode):
                continue
            if j == 0:
                return 0
            i += 1
        return i + len(tokens)
def match_tokens_lambda ( self , tokens , regions , i , f ) : for j , token in enumerate ( tokens ) : if j + i >= len ( regions ) : return 0 if not regions [ i + j ] . get_TextEquiv ( ) [ 0 ] . Unicode : self . log . warn ( "cannot find %s" , token ) return 0 self . log . debug ( 'checking %s with %s' , token , regions [ i + j ] . get_TextEquiv ( ) [ 0 ] . Unicode ) if f ( token , regions [ i + j ] . get_TextEquiv ( ) [ 0 ] . Unicode ) : continue if j == 0 : return 0 i += 1 return i + len ( tokens )
Returns one after the last index of the match starting from i.
Returns one after the last index of the match starting from i .
"""
        Returns one after the last index of the match starting from i.
        Returns 0 if nothing could be matched.
        """ # skip this and try next one # if we already have found a # match ath the first token position
self
tokens
regions
i
f