def max_chunk(ref, hyp): n_matches = len(align.alignment(ref, hyp)) if n_matches == 0: return 0 return max(len(chunk) for chunk in align.chunks(ref, hyp))/float(n_matches)
def fragmentation(ref, hyp): n_matches = len(align.alignment(ref, hyp)) if n_matches == 0: return 0 n_chunks = sum(1 for c in align.chunks(ref, hyp)) return n_chunks/float(n_matches)