, w |N | } be the set of n-grams and let a local gain function g w : E × E → R, for w ∈ N , be as follows: where θ w is a constant, # w (E ) is the number of times that w occurs in E , and δ w (E) is 1 if w ∈ E and 0 otherwise.
g w is θ w times the number of occurrences of w in E , or zero if w does not occur in E. We first assume that the overall gain function G(E, E ) can then be written as a sum of local 1 using the log semiring's extend operator gain functions and a constant θ 0 times the length of the hypothesis E .