def create(self, state): """ Create the Markov chain itself. We use the parameter instead of the attribute so we can compute the matrix for different states """ # Separete the letters considering the letter and the symbol as a unique state: # So from "88,a,b," we get: '8' '8,' 'a,' 'b,' try: # This is a first order markov model. Each individual object (letter, number, etc.) is a state separated_letters = list(state) except AttributeError: print_error('There is no state yet') return False # Generate the MC self.init_vector, self.matrix = mc.maximum_likelihood_probabilities(separated_letters, order=1)