Skip to content

Instantly share code, notes, and snippets.

@prateekjoshi565
Created July 28, 2020 07:01
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
# create integer-to-token mapping
int2token = {}
cnt = 0
for w in set(" ".join(movie_plots).split()):
int2token[cnt] = w
cnt+= 1
# create token-to-integer mapping
token2int = {t: i for i, t in int2token.items()}
token2int["the"], int2token[14271]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment