Implements Probabilistic Earley and fixes Viterbi