def prf(correct, pred_sum, gold_sum):
    """
    Calculate precision, recall and f1 score
    Parameters
    ----------
    correct : int
                number of correct predictions
    pred_sum : int
                number of predictions
    gold_sum : int
                number of gold answers
    Returns
    -------
    tuple
                (p, r, f)
    """
    if pred_sum:
        p = correct / pred_sum
    else:
        p = 0
    if gold_sum:
        r = correct / gold_sum
    else:
        r = 0
    if p + r:
        f = 2 * p * r / (p + r)
    else:
        f = 0
    return p, r, f