def read_sentences():
id_to_sents = collections.defaultdict(list)
with open(OPTS.batch_file) as f:
reader = csv.DictReader(f)
for row in reader:
input_qids = row['Input.qids'].split('\t')
input_sents = row['Input.sents'].split('\t')
ans_is_good = row['Answer.is-good'].split('\t')
ans_responses = row['Answer.responses'].split('\t')
for qid, s, is_good, response in zip(input_qids, input_sents, ans_is_good, ans_responses):
if is_good == 'yes':
response = s
if response not in id_to_sents[qid]:
id_to_sents[qid].append(response)
return id_to_sents
评论列表
文章目录