Skip to content

Instantly share code, notes, and snippets.

@prateekjoshi565
Created July 28, 2020 07:01
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 prateekjoshi565/10aad66efe6e04d8b6d940a4c1a6572c to your computer and use it in GitHub Desktop.
Save prateekjoshi565/10aad66efe6e04d8b6d940a4c1a6572c to your computer and use it in GitHub Desktop.
# 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