Update disrpt.py
Browse files
disrpt.py
CHANGED
@@ -123,6 +123,7 @@ class Dataset(datasets.GeneratorBasedBuilder):
|
|
123 |
self.BUILDER_CONFIG_CLASS.__post_init__=lambda x:x
|
124 |
base_kwargs_names=get_kwarg_names(super().__init__)
|
125 |
gen_kwargs={}
|
|
|
126 |
for k,v in copy.deepcopy(kwargs).items():
|
127 |
if k not in base_kwargs_names:
|
128 |
gen_kwargs[k]=v
|
@@ -137,6 +138,7 @@ class Dataset(datasets.GeneratorBasedBuilder):
|
|
137 |
type = self.config.name.split('.')[-1]
|
138 |
urls={k:v for (k,v) in _URLs.items() if cfg_name in k and requests.get(v).status_code!=404}
|
139 |
data_file = dl_manager.download(urls)
|
|
|
140 |
train_key = data_dir+'-train'
|
141 |
print("datafile:",data_file, self.config.data_dir)
|
142 |
if train_key in data_file:
|
@@ -155,6 +157,7 @@ class Dataset(datasets.GeneratorBasedBuilder):
|
|
155 |
|
156 |
def _generate_examples(self, filepath):
|
157 |
print(filepath)
|
|
|
158 |
with open(filepath, encoding="utf-8") as f:
|
159 |
if "conllu" in self.config.name:
|
160 |
stream=parse_conll_stream(f)
|
|
|
123 |
self.BUILDER_CONFIG_CLASS.__post_init__=lambda x:x
|
124 |
base_kwargs_names=get_kwarg_names(super().__init__)
|
125 |
gen_kwargs={}
|
126 |
+
self.files={}
|
127 |
for k,v in copy.deepcopy(kwargs).items():
|
128 |
if k not in base_kwargs_names:
|
129 |
gen_kwargs[k]=v
|
|
|
138 |
type = self.config.name.split('.')[-1]
|
139 |
urls={k:v for (k,v) in _URLs.items() if cfg_name in k and requests.get(v).status_code!=404}
|
140 |
data_file = dl_manager.download(urls)
|
141 |
+
self.files[self.config.name]=data_file
|
142 |
train_key = data_dir+'-train'
|
143 |
print("datafile:",data_file, self.config.data_dir)
|
144 |
if train_key in data_file:
|
|
|
157 |
|
158 |
def _generate_examples(self, filepath):
|
159 |
print(filepath)
|
160 |
+
print('self.files',self.files)
|
161 |
with open(filepath, encoding="utf-8") as f:
|
162 |
if "conllu" in self.config.name:
|
163 |
stream=parse_conll_stream(f)
|