aneesh-joshi / LSTM_POS_Tagger

A simple POS Tagger made using a Bidirectional LSTM using keras trained on the Brown Corpus
34 stars 19 forks source link

wrong variable name in make_glove_pickle.py #10

Closed dutkaD closed 6 years ago

dutkaD commented 6 years ago
glove_file = open('glove.6B.100d.txt', encoding="utf8")

for line in glove_file:
    values = line.split()
    word = values[0]
    coefs = np.asarray(values[1:], dtype='float32')
    embeddings_index[word] = coefs
f.close()

should be glove_file.close()

aneesh-joshi commented 6 years ago

Thanks for the report @dutkaD Will fix it.

I'd be happy to merge PRs if you have any.

I've fixed it for now: https://github.com/aneesh-joshi/LSTM_POS_Tagger/blob/502b2637964be3ae872a8f2f012bb21306cc8057/make_glove_pickle.py#L11

with open('glove.6B.100d.txt', encoding="utf8") as glove_file:
    for line in glove_file:
        values = line.split()
        word = values[0]
        coefs = np.asarray(values[1:], dtype='float32')
        embeddings_index[word] = coefs