Removed labels file and fixed bug when running on a test dataset
@@ -25,20 +25,16 @@ def generate_queries_and_qrels(args):
print('Generating qrels...')
qrels_out = open(args.output_qrels_file, 'w', encoding='utf-8')
- # open labels file if provided
- if args.output_labels_file:
- print('Generating labels...')
- labels_out = open(args.output_labels_file, 'w', encoding='utf-8')
-
for line in f_in:
line_json = json.loads(line.strip())
qid = line_json['id']
query = line_json['claim']
- if 'label' in line_json: # no "label" field in test datasets
- label = line_json['label']
# save query to queries dict
queries[qid] = query
+
+ if 'label' in line_json: # no "label" field in test datasets
+ label = line_json['label']
if label == 'NOT ENOUGH INFO':
continue
@@ -61,19 +57,10 @@ def generate_queries_and_qrels(args):
for doc_id in evidences:
qrels_out.write(f'{qid}\t0\t{doc_id}\t2\n')
- # write claims and labels to labels file if provided
- if args.output_labels_file:
- score = 1 if label == 'SUPPORTS' else 0
- labels_out.write(f'{qid}\t{score}\n')
-
# close qrels file if provided
if args.output_qrels_file:
qrels_out.close()
- # close labels file if provided
- if args.output_labels_file:
- labels_out.close()
-
# write queries to queries file if provided
if args.output_queries_file:
print('Generating queries...')
@@ -86,7 +73,6 @@ if __name__ == '__main__':
parser.add_argument('--dataset_file', required=True, help='FEVER dataset file.')
parser.add_argument('--output_queries_file', help='Output queries file.')
parser.add_argument('--output_qrels_file', help='Output qrels file.')
- parser.add_argument('--output_labels_file', help='Output labels file.')
parser.add_argument('--granularity',
required=True,
choices=['paragraph', 'sentence'],
