def calc_f(tp: int, fp: int, fn: int):
    """
    Calculates the F1-Score

    NOTE: This follows standard evaluation metrics
    TAKEN FROM: Open-SESAME (https://github.com/swabhs/open-sesame)

    :param tp: True Postivies Count
    :param fp: False Postivies Count
    :param fn: False Negatives Count
    :return: A Triple of Precision, Recall and F1-Score
    """
    if tp == 0.0 and fp == 0.0:
        pr = 0.0
    else:
        pr = tp / (tp + fp)
    if tp == 0.0 and fn == 0.0:
        re = 0.0
    else:
        re = tp / (tp + fn)
    if pr == 0.0 and re == 0.0:
        f = 0.0
    else:
        f = 2.0 * pr * re / (pr + re)
    return pr, re, f