Amanpreet Singh commited on
Commit
a6dcae9
1 Parent(s): df53f7b

Use complete snippets as suggested by BLURB paper

Browse files
Files changed (1) hide show
  1. bioasq_task_b.py +16 -12
bioasq_task_b.py CHANGED
@@ -643,15 +643,19 @@ class BioasqTaskBDataset(datasets.GeneratorBasedBuilder):
643
  continue
644
  if self.config.type_subset is not None and self.config.type_subset != record["type"]:
645
  continue
646
- for i, snippet in enumerate(record["snippets"]):
647
- yield uid, {
648
- "id": f'{record["id"]}_{i}',
649
- "document_id": snippet["document"],
650
- "question_id": record["id"],
651
- "question": record["body"],
652
- "type": record["type"],
653
- "choices": [],
654
- "context": snippet["text"],
655
- "answer": self._get_exact_answer(record),
656
- }
657
- uid += 1
 
 
 
 
 
643
  continue
644
  if self.config.type_subset is not None and self.config.type_subset != record["type"]:
645
  continue
646
+ snippets = record['snippets']
647
+ snippets_text = [snippet['text'].replace(
648
+ '\n', ' ') for snippet in snippets]
649
+ passage = " ".join(snippets_text)
650
+
651
+ yield uid, {
652
+ "id": record["id"],
653
+ "document_id": record["id"],
654
+ "question_id": record["id"],
655
+ "question": record["body"],
656
+ "type": record["type"],
657
+ "choices": [],
658
+ "context": passage,
659
+ "answer": self._get_exact_answer(record),
660
+ }
661
+ uid += 1