Skip to content

Instantly share code, notes, and snippets.

@paulegradie
Last active August 20, 2019 02:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulegradie/4a34474a2b7688a7c18a492b652427bd to your computer and use it in GitHub Desktop.
Save paulegradie/4a34474a2b7688a7c18a492b652427bd to your computer and use it in GitHub Desktop.
A sample word2index generated in python.
"""
# The map
word | idx
----------------
king | 0
male | 1
queen | 2
female | 3
"""
word_to_index = {
word: idx for idx, word in enumerate(['king', ‘male’, 'queen', ‘female’])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment