def alignment_error_rate(reference, hypothesis, possible=None):
 if (possible is None):
  possible = reference
 else:
  assert reference.issubset(possible)
 return (1.0 - ((len((hypothesis & reference)) + len((hypothesis & possible))) / float((len(hypothesis) + len(reference)))))

def alignment_error_rate ( reference , hypothesis , possible = None ) : if ( possible is None ) : possible = reference else : assert reference . issubset ( possible ) return ( 1.0 - ( ( len ( ( hypothesis & reference ) ) + len ( ( hypothesis & possible ) ) ) / float ( ( len ( hypothesis ) + len ( reference ) ) ) ) )
return the alignment error rate of an alignment with respect to a "gold standard" reference alignment .