(results, partial_or_type=False)
return results
Takes a result dict that has been output by compute metrics.
    Returns the results dict with precison and recall populated.

    When the results dicts is from partial or ent_type metrics, then
    partial_or_type=True to ensure the right calculation is used for
    calculating precision and recall.
Takes a result dict that has been output by compute metrics.
    Returns the results dict with precison and recall populated.
Takes a result dict that has been output by compute metrics . Returns the results dict with precison and recall populated .
def compute_precision_recall(results, partial_or_type=False):
    """
    Takes a result dict that has been output by compute metrics.
    Returns the results dict with precison and recall populated.

    When the results dicts is from partial or ent_type metrics, then
    partial_or_type=True to ensure the right calculation is used for
    calculating precision and recall.
    """

    actual = results["actual"]
    possible = results["possible"]
    partial = results['partial']
    correct = results['correct']

    if partial_or_type:
        precision = (correct + 0.5 * partial) / actual if actual > 0 else 0
        recall = (correct + 0.5 * partial) / possible if possible > 0 else 0

    else:
        precision = correct / actual if actual > 0 else 0
        recall = correct / possible if possible > 0 else 0

    results["precision"] = precision
    results["recall"] = recall

    return results
def compute_precision_recall ( results , partial_or_type = False ) : actual = results [ "actual" ] possible = results [ "possible" ] partial = results [ 'partial' ] correct = results [ 'correct' ] if partial_or_type : precision = ( correct + 0.5 * partial ) / actual if actual > 0 else 0 recall = ( correct + 0.5 * partial ) / possible if possible > 0 else 0 else : precision = correct / actual if actual > 0 else 0 recall = correct / possible if possible > 0 else 0 results [ "precision" ] = precision results [ "recall" ] = recall return results