def get_text_sparsity(bbox, mentions):
    """
    computes text area coverage
    :param mentions:
    :return:
    """
    b = bbox[-4:]
    bbox_area = (b[2] - b[0]) * (b[3] - b[1])
    text_area = 0
    for m in mentions:
        text_area += (m.x1 - m.x0) * (m.y1 - m.y0)
    try:
        return 1.0 * text_area / bbox_area
    except ZeroDivisionError:
        return 0.0
