pathterminuspages/language/aboutcontactabout me


04.01.2021 | Processing/Encoding/Pretrained


@1. GloVe

Here we use the GloVe pretrained word vectors for word encoding. The vector file is the one.

Now we can load the vectors with the following code:

def glove(): retval = {} with open("glove.6B.50d.txt","r") as f: for line in f: vals = line.strip().split(" ") w = vals[0] vec = [float(x.strip()) for x in vals[1:]] retval[w] = vec return retval

Note that we here load the vectors with 50 dimensions. Also note that if we read the whole file as a string and split it into lines, we easily might run out of memory.

CommentsGuest Name:Comment: