Beispiel #1
0
    def score(splits, sigma):
        splits = sorted(splits)

        result = []
        # result = sum( sigma(a,b) for (a,b) in tools.seg_iter(splits) )

        print("SCORING:", splits)
        for (a, b) in tools.seg_iter(splits):
            result.append(sigma(a, b))

        print("SCORING SUM:", splits, sum(result))
        return sum(result)
Beispiel #2
0
def c99score(distsmat, hyp, minlength=1, maxlength=None):
    """ Do the choi c99 scoring for a hypothesis splitting """
    N = distsmat.shape[0]
    beta = 0.0
    alpha = 0.0
    for (a, b) in tools.seg_iter(hyp):
        beta += distsmat[a:b, a:b].sum()
        alpha += (b - a)**2
        if minlength:
            if (b - a) < minlength: beta += -np.inf
        if maxlength:
            if (b - a) > maxlength: beta += -np.inf
    return -beta / (alpha + 0.)
 def score(splits, sigma):
     splits = sorted(splits)
     return sum(sigma(a, b) for (a, b) in tools.seg_iter(splits))
Beispiel #4
0
 def score(splits, sigma):
     splits = sorted(splits)
     return key(
         reduce(combine,
                (sigma(a, b) for (a, b) in tools.seg_iter(splits))))