def _RIPPER_growphase_prune_metric_cn(cn, rule, pos_pruneset_idx,
    neg_pruneset_idx):
    """RIPPER/IREP* prune metric.
    Returns the prune value of a candidate Rule.

    Cohen's formula is (p-n) / (p+n).
    Unclear from the paper how they handle divzero (where p+n=0), so I Laplaced it.
    Weka's solution was to modify the formula to (p+1)/(p+n+2), but the (non-NaN) values I got appeared closer to those of the original formula.
    """
    p = len(cn.rule_covers(rule, pos_pruneset_idx))
    n = len(cn.rule_covers(rule, neg_pruneset_idx))
    return (p - n + 1) / (p + n + 1)
