import json import datasets import os from os.path import join cwd = os.getcwd() class WikiDataRelationship(datasets.GeneratorBasedBuilder): VERSION = datasets.Version('1.0.0') def _info(self): features = datasets.Features({ 'text': datasets.Value('string'), }) return datasets.DatasetInfo(features=features) def _split_generators(self, dl_manager): """ Returns SplitGenerators.""" path = join(cwd,"dataset.tsv") kwargs = {'path': path} return [datasets.SplitGenerator(datasets.Split.TEST, gen_kwargs=kwargs)] def _generate_examples(self, path): with open(path, 'r') as f: for _id, line in enumerate(f.readlines()): yield _id, line