Skip to content

Instantly share code, notes, and snippets.

@santhalakshminarayana
Created January 6, 2020 06:05
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 santhalakshminarayana/f0d48aa94798e6fcea638181fd0e789a to your computer and use it in GitHub Desktop.
Save santhalakshminarayana/f0d48aa94798e6fcea638181fd0e789a to your computer and use it in GitHub Desktop.
Quotes Vocabulary Prep - Medium
words_dict = dict()
def unique_words(data_list):
for x in data_list:
for word in x.split(' '):
words_dict[word] = 1
return words_dict.keys()
words = list(unique_words(quotes))
words.sort()
word_to_int = dict()
int_to_word = dict()
vocab_len = len(words)
for i in range(0, vocab_len):
word_to_int[words[i]] = i
int_to_word[i] = words[i]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment