Datasets:
Commit ·
26d699d
1
Parent(s): e0e4fb3
Update SpaCE2021.py
Browse files115 unmodified lines11611711811911912012112212312312412518 unmodified lines1441451461481471481491505 unmodified lines156157158159160161162163164165166167163168169170171172173174170171172175176177178179180174181182115 unmodified linesclass SpaCE2021Config(datasets.BuilderConfig): """BuilderConfig for SpaCE2021."""
def __init__(self, features, splits, **kwargs): def __init__(self, splits, **kwargs): # Version history: # 1.0518.0: final version used in SpaCE2021 Eval. super().__init__(version=datasets.Version("1.0518.0"), **kwargs) self.features = features self.splits = splits
18 unmodified lines def _info(self): return datasets.DatasetInfo( description=_DESCRIPTION_DICT[self.config.name], features=_FEATURES_DICT[self.config.name], features=datasets.Features(_FEATURES_DICT[self.config.name]), homepage="http://ccl.pku.edu.cn:8084/SpaCE2021/", citation=_CITATION, license=_LICENSE,5 unmodified lines
split_things = [] for split_name in self.config.splits: # print('') split_data_path = _URLS_DICT[self.config.name][split_name] # print(split_data_path) filepath = dl_manager.download(split_data_path) # print(filepath) # print('') split_thing = datasets.SplitGenerator( name=_split_name_map[split_name], gen_kwargs={ "data_file": dl_manager.download(_URLS_DICT[self.config.name][split_name]), "filepath": filepath, "split": split_name, } ) split_things.append(split_thing) return split_things
def _generate_examples(self, filepath): with open(filepath, encoding="utf-8") as f: for idx, line in enumerate(f): def _generate_examples(self, filepath, split): with open(filepath, encoding="utf-8") as ff: for idx, line in enumerate(ff): example = json.loads(line.strip()) qid = example.get("qID") if split == qid.split("-")[2]: yield example.get("qID"), example yield example.get("qID"), example
SpaCE2021.py+15-8