def token_precision_recall(predicted_parts, gold_set_parts):
    """
    Get the precision/recall for the given token.

    :param predicted_parts: a list of predicted parts
    :param gold_set_parts: a list of the golden parts
    :return: precision, recall, f1 as floats
    """
    ground = [tok.lower() for tok in gold_set_parts]
    prediction = list(predicted_parts)

    tp = 0
    for subtoken in prediction:
        if subtoken == "***" or subtoken is None:
            continue  # Ignore UNKs
        if subtoken.lower() in ground:
            ground.remove(subtoken.lower())
            tp += 1

    precision = float(tp) / len(predicted_parts)
    recall = float(tp) / len(gold_set_parts)
    if precision + recall > 0:
        f1 = 2 * precision * recall / (precision + recall)
    else:
        f1 = 0.
    return precision, recall, f1