Computes the emissions and transitions probabilities of a corpus
            based on word types
        Args:
            corpus: the given corpus (a corpus_entry needs to be iterable)
            order: the maximal Markov chain order
        Computes:
            self.emissions: Probabilities to emit word (token_value) at state x (token_type)
            self.transitions_hmm: Transition probabilities to switch between states (token_type)
            self.emissions_past: Probabilities to emit a word (token_value) at state x
                                 (token_type) based on previous emissions (token_value)

def _compute_emissions(self, corpus, order=1):
        """ Computes the emissions and transitions probabilities of a corpus
            based on word types
        Args:
            corpus: the given corpus (a corpus_entry needs to be iterable)
            order: the maximal Markov chain order
        Computes:
            self.emissions: Probabilities to emit word (token_value) at state x (token_type)
            self.transitions_hmm: Transition probabilities to switch between states (token_type)
            self.emissions_past: Probabilities to emit a word (token_value) at state x
                                 (token_type) based on previous emissions (token_value)
        """
        self.emissions = defaultdict(lambda: defaultdict(int))
        self.transitions_hmm = defaultdict(lambda: defaultdict(int))
        self.emissions_past = defaultdict(
            lambda: defaultdict(lambda: defaultdict(int)))

        for corpus_entry in corpus:
            tokens = self.pos_tag(corpus_entry)

            last_tokens = utils.prefilled_buffer(
                self._start_symbol, length=self.order)
            last_emissions = utils.prefilled_buffer(
                self._start_symbol, length=self.order_emissions)

            for token in chain(tokens, [[self._end_symbol] * 2]):
                token_value = token[0]
                token_type = token[1]

                for suffix in utils.get_suffixes(last_tokens):
                    self.transitions_hmm[suffix][token_type] += 1
                    self.emissions[token_type][token_value] += 1

                for suffix in utils.get_suffixes(last_emissions):
                    self.emissions_past[token_type][
                        suffix][token_value] += 1

                last_tokens.append(token_type)
                last_emissions.append(token_value)

        self._compute_relative_probs(self.emissions)
        self._compute_relative_probs(self.transitions_hmm)
        for val in self.emissions_past.values():
            self._compute_relative_probs(val)