Skip to content

Commit

Permalink
skip newsgroup header (keras-team#5585)
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroyachiba authored and fchollet committed Mar 4, 2017
1 parent 5b0967a commit 65ce238
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions examples/pretrained_word_embeddings.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@
f = open(fpath)
else:
f = open(fpath, encoding='latin-1')
texts.append(f.read())
t = f.read()
i = t.find('\n\n') # skip header
if 0 < i:
t = t[i:]
texts.append(t)
f.close()
labels.append(label_id)

Expand Down Expand Up @@ -141,4 +145,4 @@

# happy learning!
model.fit(x_train, y_train, validation_data=(x_val, y_val),
epochs=2, batch_size=128)
epochs=10, batch_size=128)

0 comments on commit 65ce238

Please sign in to comment.