Created
August 1, 2020 14:21
-
-
Save arunm8489/01792149503e6f2b39c204507560da10 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#code from https://stackoverflow.com/questions/37793118/load-pretrained-glove-vectors-in-python | |
def loadGloveModel(File): | |
print("Loading Glove Model") | |
f = open(File,'r') | |
gloveModel = {} | |
for line in f: | |
splitLines = line.split() | |
word = splitLines[0] | |
wordEmbedding = np.array([float(value) for value in splitLines[1:]]) | |
gloveModel[word] = wordEmbedding | |
print(len(gloveModel)," words loaded!") | |
return gloveModel | |
glove_dict = loadGloveModel("glove.42B.300d.txt") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment