Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making SQuAD to return json (no public API change) #16

Open
wants to merge 1 commit into
base: bidaf
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions gluonnlp/data/question_answering.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down