Datasets:
ArXiv:
License:
Upload loading_script.py
Browse files- loading_script.py +55 -23
loading_script.py
CHANGED
@@ -29,6 +29,9 @@ _URLs = {
|
|
29 |
"train": "https://huggingface.co/datasets/siyangliu/PsyQA/resolve/main/train.json",
|
30 |
"valid": "https://huggingface.co/datasets/siyangliu/PsyQA/resolve/main/valid.json",
|
31 |
"test": "https://huggingface.co/datasets/siyangliu/PsyQA/resolve/main/test.json",
|
|
|
|
|
|
|
32 |
}
|
33 |
|
34 |
_STRATEGY={"Approval and Reassurance": "[AR]",
|
@@ -55,6 +58,11 @@ class PsyQA(datasets.GeneratorBasedBuilder):
|
|
55 |
name="w strategy",
|
56 |
description="",
|
57 |
version=VERSION,
|
|
|
|
|
|
|
|
|
|
|
58 |
)
|
59 |
]
|
60 |
|
@@ -87,29 +95,53 @@ class PsyQA(datasets.GeneratorBasedBuilder):
|
|
87 |
def _split_generators(self, dl_manager):
|
88 |
"""Returns SplitGenerators."""
|
89 |
data_dir = dl_manager.download_and_extract(_URLs)
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
|
114 |
def _generate_examples(self, filepath, label_filepath=None, strategy=False):
|
115 |
"""Yields examples."""
|
|
|
29 |
"train": "https://huggingface.co/datasets/siyangliu/PsyQA/resolve/main/train.json",
|
30 |
"valid": "https://huggingface.co/datasets/siyangliu/PsyQA/resolve/main/valid.json",
|
31 |
"test": "https://huggingface.co/datasets/siyangliu/PsyQA/resolve/main/test.json",
|
32 |
+
"train_translated": "https://huggingface.co/datasets/siyangliu/PsyQA/resolve/main/train_translated.json",
|
33 |
+
"valid_translated": "https://huggingface.co/datasets/siyangliu/PsyQA/resolve/main/valid_translated.json",
|
34 |
+
"test_translated": "https://huggingface.co/datasets/siyangliu/PsyQA/resolve/main/test_translated.json"
|
35 |
}
|
36 |
|
37 |
_STRATEGY={"Approval and Reassurance": "[AR]",
|
|
|
58 |
name="w strategy",
|
59 |
description="",
|
60 |
version=VERSION,
|
61 |
+
),
|
62 |
+
datasets.BuilderConfig(
|
63 |
+
name="translated",
|
64 |
+
description="",
|
65 |
+
version=VERSION,
|
66 |
)
|
67 |
]
|
68 |
|
|
|
95 |
def _split_generators(self, dl_manager):
|
96 |
"""Returns SplitGenerators."""
|
97 |
data_dir = dl_manager.download_and_extract(_URLs)
|
98 |
+
if self.config.name != "translated":
|
99 |
+
|
100 |
+
return [
|
101 |
+
datasets.SplitGenerator(
|
102 |
+
name=datasets.Split.TRAIN,
|
103 |
+
gen_kwargs={
|
104 |
+
"filepath": data_dir["train"],
|
105 |
+
"strategy": self.config.name == "w strategy"
|
106 |
+
},
|
107 |
+
),
|
108 |
+
datasets.SplitGenerator(
|
109 |
+
name=datasets.Split.TEST,
|
110 |
+
gen_kwargs={
|
111 |
+
"filepath": data_dir["test"],
|
112 |
+
"strategy": self.config.name == "w strategy"
|
113 |
+
},
|
114 |
+
),
|
115 |
+
datasets.SplitGenerator(
|
116 |
+
name=datasets.Split.VALIDATION,
|
117 |
+
gen_kwargs={
|
118 |
+
"filepath": data_dir["valid"],
|
119 |
+
"strategy": self.config.name == "w strategy"
|
120 |
+
},
|
121 |
+
),
|
122 |
+
]
|
123 |
+
else:
|
124 |
+
return [
|
125 |
+
datasets.SplitGenerator(
|
126 |
+
name=datasets.Split.TRAIN,
|
127 |
+
gen_kwargs={
|
128 |
+
"filepath": data_dir["train_translated"]
|
129 |
+
},
|
130 |
+
),
|
131 |
+
datasets.SplitGenerator(
|
132 |
+
name=datasets.Split.TEST,
|
133 |
+
gen_kwargs={
|
134 |
+
"filepath": data_dir["test_translated"]
|
135 |
+
},
|
136 |
+
),
|
137 |
+
datasets.SplitGenerator(
|
138 |
+
name=datasets.Split.VALIDATION,
|
139 |
+
gen_kwargs={
|
140 |
+
"filepath": data_dir["valid_translated"]
|
141 |
+
},
|
142 |
+
),
|
143 |
+
]
|
144 |
+
|
145 |
|
146 |
def _generate_examples(self, filepath, label_filepath=None, strategy=False):
|
147 |
"""Yields examples."""
|