Module generation
This module allows you to build the matrix from the processed dictionary and generate words.
Functions
def build_ND_matrix(dictionary, alphabet, N)
-
build_ND_matrix()
initiate and fill a N dimension matrix (dict of dict object) by browsing the dictionary.- dictionary (list): the input dictionary (after processing)
- alphabet (list): the used alphabet (from input file or from dictionary)
- N (int): the dimension of the matrix
- return (dict): the matrix representing the probability of letter chaining each other
def generate_word_ND(matrix, alphabet, prefix, N)
-
generate_word_ND()
generates a word used therandom.choices()
method uppon the ND matrix in the last letter column.- matrix (dict): the matrix representing the probability of letter chaining each other
- alphabet (list): the used alphabet (from input file or from dictionary)
- prefix (str): the prefix requested for the generated words
- N (int): the dimension of the matrix
- return (str): the generated word (length variable)