def align_log_prob(i, j, source_sents, target_sents, alignment, params):
 l_s = sum((source_sents[((i - offset) - 1)] for offset in range(alignment[0])))
 l_t = sum((target_sents[((j - offset) - 1)] for offset in range(alignment[1])))
 try:
  m = ((l_s + (l_t / params.AVERAGE_CHARACTERS)) / 2)
  delta = (((l_s * params.AVERAGE_CHARACTERS) - l_t) / math.sqrt((m * params.VARIANCE_CHARACTERS)))
 except ZeroDivisionError:
  return float('-inf')
 return (- ((LOG2 + norm_logsf(abs(delta))) + math.log(params.PRIORS[alignment])))

def align_log_prob ( i , j , source_sents , target_sents , alignment , params ) : l_s = sum ( ( source_sents [ ( ( i - offset ) - 1 ) ] for offset in range ( alignment [ 0 ] ) ) ) l_t = sum ( ( target_sents [ ( ( j - offset ) - 1 ) ] for offset in range ( alignment [ 1 ] ) ) ) try : m = ( ( l_s + ( l_t / params . AVERAGE_CHARACTERS ) ) / 2 ) delta = ( ( ( l_s * params . AVERAGE_CHARACTERS ) - l_t ) / math . sqrt ( ( m * params . VARIANCE_CHARACTERS ) ) ) except ZeroDivisionError : return float ( '-inf' ) return ( - ( ( LOG2 + norm_logsf ( abs ( delta ) ) ) + math . log ( params . PRIORS [ alignment ] ) ) )
returns the log probability of the two sentences c{source_sents[i]} .