def link_density(el):
    """Returns a ratio between link text and regular text inside an element"""
    link_length = len("".join([i.get_text(strip=True) or "" for i in el.find_all("a")]))
    text_length = len(el.get_text(strip=True))
    return float(link_length) / max(text_length, 1)