-
-
Save NoelKennedy/775f88a3ce31c3f75326e2d9d62a6290 to your computer and use it in GitHub Desktop.
Sentence initialisation for word2vec
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
def make_random_input_sentence(sequence_length=300,word2vec): | |
import random | |
input_words=list() | |
input_sentence=list() | |
for i in range(0,sequence_length): | |
word=random.choice(list(sg.wv.vocab.keys())) | |
input_words.append(word) | |
vector=word2vec[word] | |
input_sentence.append(vector) | |
input_sentence=np.array(input_sentence) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment