Skip to content

Instantly share code, notes, and snippets.

@jamescalam
Last active April 1, 2020 16:28
Show Gist options
  • Save jamescalam/5d91af05242cfe2f9beebee861dcf1d1 to your computer and use it in GitHub Desktop.
Save jamescalam/5d91af05242cfe2f9beebee861dcf1d1 to your computer and use it in GitHub Desktop.
Short code for building mapping of character to index (char2idx) and index to character (idx2char).
char2idx = {c:i for i, c in enumerate(vocab)}
idx2char = np.array(vocab)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment