Created
January 6, 2020 06:05
-
-
Save santhalakshminarayana/f0d48aa94798e6fcea638181fd0e789a to your computer and use it in GitHub Desktop.
Quotes Vocabulary Prep - Medium
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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