leaf_focus/ocr/recognise/item.py
def is_same_line(self, other: "Item"):
        """
        Check if other found text overlaps this found text.
        Calculated as the midpoint +- 1/3 of the height of the text
        """
        if not other:
            return False
        self_bounds = self.line_bounds
        self_top = self_bounds[0]
        self_bottom = self_bounds[1]
        self_third = (self_bottom - self_top) / 3
        self_top += self_third
        self_bottom -= self_third

        other_bounds = other.line_bounds
        other_top = other_bounds[0]
        other_bottom = other_bounds[1]
        other_third = (other_bottom - other_top) / 3
        other_top += other_third
        other_bottom -= other_third

        return self_top <= other_bottom and other_top <= self_bottom

        Check if other found text overlaps this found text.
        Calculated as the midpoint +- 1/3 of the height of the text
        
Check if other found text overlaps this found text.
Calculated as the midpoint +- 1/3 of the height of the text
Check if other found text overlaps this found text . Calculated as the midpoint + - 1 / 3 of the height of the text
def is_same_line(self, other: "Item"):
        if not other:
            return False
        self_bounds = self.line_bounds
        self_top = self_bounds[0]
        self_bottom = self_bounds[1]
        self_third = (self_bottom - self_top) / 3
        self_top += self_third
        self_bottom -= self_third
        other_bounds = other.line_bounds
        other_top = other_bounds[0]
        other_bottom = other_bounds[1]
        other_third = (other_bottom - other_top) / 3
        other_top += other_third
        other_bottom -= other_third
        return self_top <= other_bottom and other_top <= self_bottom
def is_same_line ( self , other : "Item" ) : if not other : return False self_bounds = self . line_bounds self_top = self_bounds [ 0 ] self_bottom = self_bounds [ 1 ] self_third = ( self_bottom - self_top ) / 3 self_top += self_third self_bottom -= self_third other_bounds = other . line_bounds other_top = other_bounds [ 0 ] other_bottom = other_bounds [ 1 ] other_third = ( other_bottom - other_top ) / 3 other_top += other_third other_bottom -= other_third return self_top <= other_bottom and other_top <= self_bottom
Check if other found text overlaps this found text.
Check if other found text overlaps this found text .
"""
        Check if other found text overlaps this found text.
        Calculated as the midpoint +- 1/3 of the height of the text
        """
self
other
"Item"