Datasets:
Tasks:
Question Answering
Modalities:
Text
Sub-tasks:
extractive-qa
Languages:
code
Size:
100K - 1M
License:
Fix: for relevance single context block
Browse files- codequeries.py +11 -6
codequeries.py
CHANGED
|
@@ -137,14 +137,22 @@ class Codequeries(datasets.GeneratorBasedBuilder):
|
|
| 137 |
features["query_name"] = datasets.Value("string")
|
| 138 |
features["code_file_path"] = datasets.Value("string")
|
| 139 |
if self.config.name != "prefix":
|
| 140 |
-
|
| 141 |
-
{
|
| 142 |
"content": datasets.Value("string"),
|
| 143 |
"metadata": datasets.Value("string"),
|
| 144 |
"header": datasets.Value("string"),
|
| 145 |
"index": datasets.Value("int32")
|
| 146 |
}
|
| 147 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
features["answer_spans"] = [
|
| 149 |
{
|
| 150 |
'span': datasets.Value("string"),
|
|
@@ -222,13 +230,10 @@ class Codequeries(datasets.GeneratorBasedBuilder):
|
|
| 222 |
|
| 223 |
if self.config.name == "twostep":
|
| 224 |
key = 0
|
| 225 |
-
print('File paths: ', filepath)
|
| 226 |
for fp in filepath:
|
| 227 |
with open(fp, encoding="utf-8") as f:
|
| 228 |
for line in f:
|
| 229 |
-
print(line)
|
| 230 |
row = json.loads(line)
|
| 231 |
-
print(row)
|
| 232 |
instance_key = str(key) + "_" + row["query_name"] + "_" + row["code_file_path"]
|
| 233 |
yield instance_key, {
|
| 234 |
"query_name": row["query_name"],
|
|
|
|
| 137 |
features["query_name"] = datasets.Value("string")
|
| 138 |
features["code_file_path"] = datasets.Value("string")
|
| 139 |
if self.config.name != "prefix":
|
| 140 |
+
if self.config.name == "twostep":
|
| 141 |
+
features["context_blocks"] = {
|
| 142 |
"content": datasets.Value("string"),
|
| 143 |
"metadata": datasets.Value("string"),
|
| 144 |
"header": datasets.Value("string"),
|
| 145 |
"index": datasets.Value("int32")
|
| 146 |
}
|
| 147 |
+
else:
|
| 148 |
+
features["context_blocks"] = [
|
| 149 |
+
{
|
| 150 |
+
"content": datasets.Value("string"),
|
| 151 |
+
"metadata": datasets.Value("string"),
|
| 152 |
+
"header": datasets.Value("string"),
|
| 153 |
+
"index": datasets.Value("int32")
|
| 154 |
+
}
|
| 155 |
+
]
|
| 156 |
features["answer_spans"] = [
|
| 157 |
{
|
| 158 |
'span': datasets.Value("string"),
|
|
|
|
| 230 |
|
| 231 |
if self.config.name == "twostep":
|
| 232 |
key = 0
|
|
|
|
| 233 |
for fp in filepath:
|
| 234 |
with open(fp, encoding="utf-8") as f:
|
| 235 |
for line in f:
|
|
|
|
| 236 |
row = json.loads(line)
|
|
|
|
| 237 |
instance_key = str(key) + "_" + row["query_name"] + "_" + row["code_file_path"]
|
| 238 |
yield instance_key, {
|
| 239 |
"query_name": row["query_name"],
|