nltk.IBMModel2.prob_all_alignments

IBMModel2.prob_all_alignments(src_sentence, trg_sentence)[source]

Computes the probability of all possible word alignments, expressed as a marginal distribution over target words t

Each entry in the return value represents the contribution to the total alignment probability by the target word t.

To obtain probability(alignment | src_sentence, trg_sentence), simply sum the entries in the return value.

Returns:Probability of t for all s in src_sentence
Return type:dict(str): float