loops from the start state to the end state and records the emissions
        Tokens are joint to sentences by looking ahead for the next token type

        emit: by default the markovian emit (see HMM for different emission forms)
        max_length: maximum number of emissions

def _text_generator(self, next_token=None, emit=lambda x, _, __: x, max_length=None):
        """ loops from the start state to the end state and records the emissions
        Tokens are joint to sentences by looking ahead for the next token type

        emit: by default the markovian emit (see HMM for different emission forms)
        max_length: maximum number of emissions
        """
        assert next_token is not None
        last_tokens = utils.prefilled_buffer(
            self._start_symbol, length=self.order)
        if hasattr(self, "order_emissions"):
            order_emissions = self.order_emissions
        else:
            order_emissions = self.order
        last_emissions = utils.prefilled_buffer(
            self._start_symbol, length=order_emissions)
        generated_tokens = []
        while last_tokens[-1] != self._end_symbol:
            new_token = next_token(last_tokens)
            emission = emit(new_token, last_tokens, last_emissions)
            last_emissions.append(emission)
            generated_tokens.append(emission)
            last_tokens.append(new_token)
            # cut-off for max. emissions
            # + 1 for the start state
            if max_length is not None and max_length + 1 <= len(generated_tokens):
                break
        text = generated_tokens[:-1]
        return text