示例#1
0
def is_horz_aligned(c: Candidate) -> bool:
    """Return True if all the components of c are horizontally aligned.

    Horizontal alignment means that the bounding boxes of each Mention of c
    shares a similar y-axis value in the visual rendering of the document.

    :param c: The candidate to evaluate
    """
    return all([
        _to_span(c[i]).sentence.is_visual() and bbox_horz_aligned(
            _to_span(c[i]).get_bbox(),
            _to_span(c[0]).get_bbox()) for i in range(len(c))
    ])
示例#2
0
def is_horz_aligned(c):
    """Return True if all the components of c are horizontally aligned.

    Horizontal alignment means that the bounding boxes of each Span of c shares
    a similar y-axis value in the visual rendering of the document.

    :param c: The candidate to evaluate
    :rtype: boolean
    """
    return all([
        c[i].sentence.is_visual()
        and bbox_horz_aligned(bbox_from_span(c[i]), bbox_from_span(c[0]))
        for i in range(len(c))
    ])