Created
March 13, 2018 17:53
-
-
Save dipanjanS/84f415ae0781c1d42f6fb0ac843bf63e to your computer and use it in GitHub Desktop.
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
from keras.preprocessing import text | |
tokenizer = text.Tokenizer() | |
tokenizer.fit_on_texts(norm_bible) | |
word2id = tokenizer.word_index | |
id2word = {v:k for k, v in word2id.items()} | |
vocab_size = len(word2id) + 1 | |
embed_size = 100 | |
wids = [[word2id[w] for w in text.text_to_word_sequence(doc)] for doc in norm_bible] | |
print('Vocabulary Size:', vocab_size) | |
print('Vocabulary Sample:', list(word2id.items())[:10]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think norm_bible is the corpus
norm_bible=open('corona.txt','r')