def recall_at_n(ranks, n=3):
    """
    Calculate recall @ N
    Function taken from: https://github.com/google/retrieval-qa-eval/blob/master/squad_eval.py

    Args:
    -----
        ranks: (list) predicted ranks of the correct responses 
    return:
    -------
        Recall@N: (float)
    """
    num = len([rank for rank in ranks if rank <= n])
    return num / len(ranks)