Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Fixed bug on building fb data #171

Merged
merged 2 commits into from
Jun 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 5 additions & 4 deletions parlai/tasks/qacnn/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ def _process(fname, fout):
# main article
s = '1 ' + lines[2]
# add question
s = s + lines[4]
s = s + ' ' + lines[4]
# add answer
s = s + '\t' + lines[6]
# add candidates (and strip them of the real names)
for i in range(8, len(lines)):
lines[i] = lines[i].split(':')[0]
s = s + '\t\t' + '|'.join(lines[8:-1])
s = s + '\t\t' + '|'.join(lines[8:])
fout.write(s + '\n\n')


Expand All @@ -35,9 +35,10 @@ def create_fb_format(outpath, dtype, inpath):


def build(opt):
version = 'v1.0'
dpath = os.path.join(opt['datapath'], 'QACNN')

if not build_data.built(dpath):
if not build_data.built(dpath, version):
print('[building data: ' + dpath + ']')
build_data.remove_dir(dpath)
build_data.make_dir(dpath)
Expand All @@ -56,4 +57,4 @@ def build(opt):
os.path.join(dpath, 'cnn', 'questions', 'test'))

# Mark the data as built.
build_data.mark_done(dpath)
build_data.mark_done(dpath, version)
9 changes: 5 additions & 4 deletions parlai/tasks/qadailymail/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ def _process(fname, fout):
# main article
s = '1 ' + lines[2]
# add question
s = s + lines[4]
s = s + ' ' + lines[4]
# add answer
s = s + '\t' + lines[6]
# add candidates (and strip them of the real names)
for i in range(8, len(lines)):
lines[i] = lines[i].split(':')[0]
s = s + '\t\t' + '|'.join(lines[8:-1])
s = s + '\t\t' + '|'.join(lines[8:])
fout.write(s + '\n\n')


Expand All @@ -35,9 +35,10 @@ def create_fb_format(outpath, dtype, inpath):


def build(opt):
version = 'v1.0'
dpath = os.path.join(opt['datapath'], 'QADailyMail')

if not build_data.built(dpath):
if not build_data.built(dpath, version):
print('[building data: ' + dpath + ']')
build_data.remove_dir(dpath)
build_data.make_dir(dpath)
Expand All @@ -54,4 +55,4 @@ def build(opt):
create_fb_format(dpath, 'test', os.path.join(dpath, ext, 'test'))

# Mark the data as built.
build_data.mark_done(dpath)
build_data.mark_done(dpath, version)