def _prob_mass_function(message: str, word_length: int) -> dict:
    """
    Compute probability mass function for a one-dim discete rv, Snippet 18.1, page 266.

    :param message: (str or array) encoded message
    :param word_length: (int) approximate word length
    :return: (dict) of pmf for each word from message
    """
    lib = {}
    if not isinstance(message, str):
        message = ''.join(map(str, message))
    for i in range(word_length, len(message)):
        message_ = message[i - word_length:i]
        if message_ not in lib:
            lib[message_] = [i - word_length]
        else:
            lib[message_] = lib[message_] + [i - word_length]
    pmf = float(len(message) - word_length)
    pmf = {i: len(lib[i]) / pmf for i in lib}
    return pmf