How to compute conditional probability in code? In this paper http://www.aclweb.org/anthology/D13-1176, in "2. Framework" it says 


  We begin by describing the modelling framework underlying RCTMs. An RCTM estimates the probability $P(f \ | \ e)$ of a target sentence $f = f_1, ..., f_m$ being a translation of a source sentence $ e = e_1, ..., e_k$. Let us denote by $f_{i\ : \ j}$ the substring of words $ f_i, ..., f_j $. Using the following identity, 


$$
P(f \ | \ e) = \prod_{i=1}^m P(f_i \ | \ f_{1:i−1}, e)
$$


  an RCTM estimates $P(f|e)$ by directly computing for each target position $i$ the conditional probability $P (f_i|f_{1:i-1}, e)$ of the target word $f_i$ occurring in the translation at position $i$, given the preceding target words $f_{1:i-1}$ and the source sentence $e$.


I understand the identity that they used, but how is it implemented in terms of code? How can a module calculate such a probability?
For this specific paper, the conditional distribution is calculated as follows: 

$ P(f_i = v |f_{1:i-1} ) = \frac{\exp(o_{i,v})}{\sum_{v=1}^V\exp(o_{i,v})} $

on page 1702