bleualign/score.py
def cook_refs(refs, n=4):
    '''Takes a list of reference sentences for a single segment
    and returns an object that encapsulates everything that BLEU
    needs to know about them.'''
    
    refs = [normalize(ref) for ref in refs]
    maxcounts = {}
    for ref in refs:
        counts = count_ngrams(ref, n)
        for (ngram,count) in list(counts.items()):
            maxcounts[ngram] = max(maxcounts.get(ngram,0), count)
    return ([len(ref) for ref in refs], maxcounts)
def cook_refs(refs, n=4):
    '''Takes a list of reference sentences for a single segment
    and returns an object that encapsulates everything that BLEU
    needs to know about them.'''
    
    refs = [normalize(ref) for ref in refs]
    maxcounts = {}
    for ref in refs:
        counts = count_ngrams(ref, n)
        for (ngram,count) in list(counts.items()):
            maxcounts[ngram] = max(maxcounts.get(ngram,0), count)
    return ([len(ref) for ref in refs], maxcounts)
def cook_refs ( refs , n = 4 ) : refs = [ normalize ( ref ) for ref in refs ] maxcounts = { } for ref in refs : counts = count_ngrams ( ref , n ) for ( ngram , count ) in list ( counts . items ( ) ) : maxcounts [ ngram ] = max ( maxcounts . get ( ngram , 0 ) , count ) return ( [ len ( ref ) for ref in refs ] , maxcounts )
Takes a list of reference sentences for a single segment
    and returns an object that encapsulates everything that BLEU
    needs to know about them.
Takes a list of reference sentences for a single segment and returns an object that encapsulates everything that BLEU needs to know about them .