From 1a4948a782d4d3de650bdb6f3e2cd870661ce984 Mon Sep 17 00:00:00 2001 From: Sergey Sokolov Date: Fri, 31 Aug 2018 15:45:15 -0700 Subject: [PATCH] Making SQuAD to return json (no public API change) --- gluonnlp/data/question_answering.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gluonnlp/data/question_answering.py b/gluonnlp/data/question_answering.py index ffc29766f0..5016977a16 100644 --- a/gluonnlp/data/question_answering.py +++ b/gluonnlp/data/question_answering.py @@ -80,7 +80,7 @@ def __init__(self, segment='train', root=os.path.join('~', '.mxnet', 'datasets', self._segment = segment self._get_data() - super(SQuAD, self).__init__(self._read_data()) + super(SQuAD, self).__init__(SQuAD._get_records(self._read_data())) def _get_data(self): """Load data from the file. Does nothing if data was loaded before @@ -116,9 +116,9 @@ def _read_data(self): _, data_file_name, _ = self._data_file[self._segment] with open(os.path.join(self._root, data_file_name)) as f: - samples = json.load(f) + json_data = json.load(f) - return SQuAD._get_records(samples) + return json_data @staticmethod def _get_records(json_dict):