system HF staff commited on
Commit
fa48417
1 Parent(s): 90946e1

Update files from the datasets library (from 1.10.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.10.0

Files changed (2) hide show
  1. README.md +1 -0
  2. squad_v2.py +4 -4
README.md CHANGED
@@ -1,4 +1,5 @@
1
  ---
 
2
  annotations_creators:
3
  - crowdsourced
4
  language_creators:
1
  ---
2
+ pretty_name: SQuAD2-0
3
  annotations_creators:
4
  - crowdsourced
5
  language_creators:
squad_v2.py CHANGED
@@ -109,15 +109,15 @@ class SquadV2(datasets.GeneratorBasedBuilder):
109
  with open(filepath, encoding="utf-8") as f:
110
  squad = json.load(f)
111
  for example in squad["data"]:
112
- title = example.get("title", "").strip()
113
  for paragraph in example["paragraphs"]:
114
- context = paragraph["context"].strip()
115
  for qa in paragraph["qas"]:
116
- question = qa["question"].strip()
117
  id_ = qa["id"]
118
 
119
  answer_starts = [answer["answer_start"] for answer in qa["answers"]]
120
- answers = [answer["text"].strip() for answer in qa["answers"]]
121
 
122
  # Features currently used are "context", "question", and "answers".
123
  # Others are extracted here for the ease of future expansions.
109
  with open(filepath, encoding="utf-8") as f:
110
  squad = json.load(f)
111
  for example in squad["data"]:
112
+ title = example.get("title", "")
113
  for paragraph in example["paragraphs"]:
114
+ context = paragraph["context"] # do not strip leading blank spaces GH-2585
115
  for qa in paragraph["qas"]:
116
+ question = qa["question"]
117
  id_ = qa["id"]
118
 
119
  answer_starts = [answer["answer_start"] for answer in qa["answers"]]
120
+ answers = [answer["text"] for answer in qa["answers"]]
121
 
122
  # Features currently used are "context", "question", and "answers".
123
  # Others are extracted here for the ease of future expansions.