Skip to content
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
1 change: 1 addition & 0 deletions datasets/squad/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
pretty_name: SQuAD
annotations_creators:
- crowdsourced
language_creators:
Expand Down
8 changes: 4 additions & 4 deletions datasets/squad/squad.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@ def _generate_examples(self, filepath):
with open(filepath, encoding="utf-8") as f:
squad = json.load(f)
for article in squad["data"]:
title = article.get("title", "").strip()
title = article.get("title", "")
for paragraph in article["paragraphs"]:
context = paragraph["context"].strip()
context = paragraph["context"] # do not strip leading blank spaces GH-2585
for qa in paragraph["qas"]:
question = qa["question"].strip()
question = qa["question"]
id_ = qa["id"]

answer_starts = [answer["answer_start"] for answer in qa["answers"]]
answers = [answer["text"].strip() for answer in qa["answers"]]
answers = [answer["text"] for answer in qa["answers"]]

# Features currently used are "context", "question", and "answers".
# Others are extracted here for the ease of future expansions.
Expand Down
1 change: 1 addition & 0 deletions datasets/squad_v2/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
pretty_name: SQuAD2.0
annotations_creators:
- crowdsourced
language_creators:
Expand Down
8 changes: 4 additions & 4 deletions datasets/squad_v2/squad_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,15 @@ def _generate_examples(self, filepath):
with open(filepath, encoding="utf-8") as f:
squad = json.load(f)
for example in squad["data"]:
title = example.get("title", "").strip()
title = example.get("title", "")
for paragraph in example["paragraphs"]:
context = paragraph["context"].strip()
context = paragraph["context"] # do not strip leading blank spaces GH-2585
for qa in paragraph["qas"]:
question = qa["question"].strip()
question = qa["question"]
id_ = qa["id"]

answer_starts = [answer["answer_start"] for answer in qa["answers"]]
answers = [answer["text"].strip() for answer in qa["answers"]]
answers = [answer["text"] for answer in qa["answers"]]

# Features currently used are "context", "question", and "answers".
# Others are extracted here for the ease of future expansions.
Expand Down