Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
babi_rnn bugfix: QA19 requires vocab from the answer
For all other questions, the full vocab is in the stories and the queries
  • Loading branch information
Smerity committed Aug 6, 2015
commit 63284a47ffc83e4855004929daa42621e275a1e8
2 changes: 1 addition & 1 deletion examples/babi_rnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def vectorize_stories(data):
train = get_stories(tar.extractfile(challenge.format('train')))
test = get_stories(tar.extractfile(challenge.format('test')))

vocab = sorted(reduce(lambda x, y: x | y, (set(story + q) for story, q, answer in train + test)))
vocab = sorted(reduce(lambda x, y: x | y, (set(story + q + [answer]) for story, q, answer in train + test)))
# Reserve 0 for masking via pad_sequences
vocab_size = len(vocab) + 1
word_idx = dict((c, i + 1) for i, c in enumerate(vocab))
Expand Down