Problem When Using Datasets to Open JSONL
I am trying to open a JSONL format file using the datasets library. Here is my code:
from datasets import load_dataset
path = "./testdata.jsonl"
dataset = load_dataset('json', data_files=path, split='train')
The contents of testdata.jsonl are organized as follows (just for testing):
{"src":"hello","term":{"a":"aa"}}
{"src":"hi","term":{"b":"bb"}}
When I use the code above to load the dataset and attempt to print the second item, like this:
print(dataset[1])
I get the following output:
{'src': 'hi', 'term': {'a': None, 'b': 'bb'}}
Instead of the expected output:
{'src': 'hi', 'term': {'b': 'bb'}}
How can I obtain the second format of the dataset? Is it possible that I simply forgot to include a parameter?