Datasets:
Tasks:
Text Generation
Modalities:
Text
Sub-tasks:
language-modeling
Languages:
English
Size:
10K - 100K
ArXiv:
Tags:
question-generation
License:
update
Browse files- generate_reference_files.py +4 -1
- qg_squadshifts.py +2 -1
generate_reference_files.py
CHANGED
@@ -1,14 +1,17 @@
|
|
1 |
import os
|
2 |
from datasets import load_dataset
|
3 |
|
|
|
4 |
os.makedirs('./reference_files', exist_ok=True)
|
5 |
|
6 |
|
7 |
for split in ['test']:
|
8 |
for domain in ["default", 'new_wiki', 'nyt', 'reddit', 'amazon']:
|
9 |
-
|
|
|
10 |
for data in ['question', 'answer', 'sentence', 'paragraph']:
|
11 |
with open('./reference_files/{}-{}.{}txt'.format(data, split, "" if domain == 'default' else f"{domain}."), 'w') as f:
|
|
|
12 |
if data == 'paragraph':
|
13 |
f.write('\n'.join(dataset['paragraph_id']))
|
14 |
else:
|
|
|
1 |
import os
|
2 |
from datasets import load_dataset
|
3 |
|
4 |
+
dataset_name = 'asahi417/qg_squadshifts'
|
5 |
os.makedirs('./reference_files', exist_ok=True)
|
6 |
|
7 |
|
8 |
for split in ['test']:
|
9 |
for domain in ["default", 'new_wiki', 'nyt', 'reddit', 'amazon']:
|
10 |
+
print(split, domain, dataset_name)
|
11 |
+
dataset = load_dataset(dataset_name, domain, split=split)
|
12 |
for data in ['question', 'answer', 'sentence', 'paragraph']:
|
13 |
with open('./reference_files/{}-{}.{}txt'.format(data, split, "" if domain == 'default' else f"{domain}."), 'w') as f:
|
14 |
+
print(dataset)
|
15 |
if data == 'paragraph':
|
16 |
f.write('\n'.join(dataset['paragraph_id']))
|
17 |
else:
|
qg_squadshifts.py
CHANGED
@@ -15,6 +15,7 @@ _FILES = {
|
|
15 |
'amazon': [f'{_URL}/amazon.test{i:02d}.jsonl' for i in range(7)]
|
16 |
}
|
17 |
}
|
|
|
18 |
|
19 |
|
20 |
class QGSQuADShiftsConfig(datasets.BuilderConfig):
|
@@ -31,7 +32,7 @@ class QGSQuADShiftsConfig(datasets.BuilderConfig):
|
|
31 |
class QGSQuADShifts(datasets.GeneratorBasedBuilder):
|
32 |
|
33 |
BUILDER_CONFIGS = [QGSQuADShiftsConfig(name="default", description="All domain.")]
|
34 |
-
BUILDER_CONFIGS += [QGSQuADShiftsConfig(name=i, description=f"Domain {i}") for i in sorted(
|
35 |
|
36 |
def _info(self):
|
37 |
return datasets.DatasetInfo(
|
|
|
15 |
'amazon': [f'{_URL}/amazon.test{i:02d}.jsonl' for i in range(7)]
|
16 |
}
|
17 |
}
|
18 |
+
_DOMAIN = list(_FILES[list(_FILES.keys())[0]].keys())
|
19 |
|
20 |
|
21 |
class QGSQuADShiftsConfig(datasets.BuilderConfig):
|
|
|
32 |
class QGSQuADShifts(datasets.GeneratorBasedBuilder):
|
33 |
|
34 |
BUILDER_CONFIGS = [QGSQuADShiftsConfig(name="default", description="All domain.")]
|
35 |
+
BUILDER_CONFIGS += [QGSQuADShiftsConfig(name=i, description=f"Domain {i}") for i in sorted(_DOMAIN)]
|
36 |
|
37 |
def _info(self):
|
38 |
return datasets.DatasetInfo(
|