Exemplo n.º 1
0
def is_vert_aligned_left(c):
    """Return true if all the components of c are vertically aligned based on their left border.

    Vertical alignment means that the bounding boxes of each Span of c shares
    a similar x-axis value in the visual rendering of the document. In this function
    the similarity of the x-axis value is based on the left border of their bounding boxes.

    :param c: The candidate to evaluate
    :rtype: boolean
    """
    return all([
        c[i].sentence.is_visual()
        and bbox_vert_aligned_left(bbox_from_span(c[i]), bbox_from_span(c[0]))
        for i in range(len(c))
    ])
Exemplo n.º 2
0
def is_vert_aligned_left(c: Candidate) -> bool:
    """Return true if all components are vertically aligned on their left border.

    Vertical alignment means that the bounding boxes of each Mention of c
    shares a similar x-axis value in the visual rendering of the document. In
    this function the similarity of the x-axis value is based on the left
    border of their bounding boxes.

    :param c: The candidate to evaluate
    """
    return all([
        _to_span(c[i]).sentence.is_visual() and bbox_vert_aligned_left(
            _to_span(c[i]).get_bbox(),
            _to_span(c[0]).get_bbox()) for i in range(len(c))
    ])