"""Character-level encoding utilities for the Shakespeare dataset."""

ALL_LETTERS = "\n !\"&'(),-.0123456789:;>?ABCDEFGHIJKLMNOPQRSTUVWXYZ[]abcdefghijklmnopqrstuvwxyz}"
NUM_LETTERS = len(ALL_LETTERS)  # 80


def letter_to_vec(letter):
    """Return the integer index of *letter* in ALL_LETTERS."""
    return ALL_LETTERS.find(letter)


def word_to_indices(word):
    """Return a list of character indices for every character in *word*."""
    return [ALL_LETTERS.find(c) for c in word]
