KlaudiaTH
commited on
Commit
•
301b108
1
Parent(s):
fcf6b5e
Debugged dataset loading script.
Browse files- dataset_infos.json +1 -0
- tedrics_data.py +42 -15
- tedrics_data_codefunctions.json +2 -41
- tedrics_data_codefunctions_val.json +42 -0
- tedrics_data_tasks.json +1 -1
- tedrics_data_testcases.json +1 -126
- tedrics_data_testcases_val.json +127 -0
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"tasks": {"description": "", "citation": "@misc{,\n title={ },\n author={},\n year={2022}\n}\n", "homepage": "", "license": "CC BY-SA", "features": {"task_id": {"dtype": "int32", "id": null, "_type": "Value"}, "mbpp_task_id": {"dtype": "int32", "id": null, "_type": "Value"}, "source": {"dtype": "string", "id": null, "_type": "Value"}, "licence": {"dtype": "string", "id": null, "_type": "Value"}, "task": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "te_dri_cs_data", "config_name": "tasks", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 3486, "num_examples": 20, "dataset_name": "te_dri_cs_data"}}, "download_checksums": {"tedrics_data_tasks.json": {"num_bytes": 5692, "checksum": "d58a1d89204b3529b7182daba3e3fdf0fa184a1127354f73ff2a9e0c404b562d"}}, "download_size": 5692, "post_processing_size": null, "dataset_size": 3486, "size_in_bytes": 9178}, "testcases": {"description": "", "citation": "@misc{,\n title={ },\n author={},\n year={2022}\n}\n", "homepage": "", "license": "CC BY-SA", "features": {"task_id": {"dtype": "int32", "id": null, "_type": "Value"}, "mbpp_task_id": {"dtype": "int32", "id": null, "_type": "Value"}, "task": {"dtype": "string", "id": null, "_type": "Value"}, "test_cases": {"feature": {"test_case_id": {"dtype": "int32", "id": null, "_type": "Value"}, "cot": {"dtype": "string", "id": null, "_type": "Value"}, "input": {"dtype": "string", "id": null, "_type": "Value"}, "output": {"dtype": "string", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "te_dri_cs_data", "config_name": "testcases", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 15460, "num_examples": 15, "dataset_name": "te_dri_cs_data"}, "validation": {"name": "validation", "num_bytes": 4987, "num_examples": 5, "dataset_name": "te_dri_cs_data"}}, "download_checksums": {"tedrics_data_testcases.json": {"num_bytes": 19781, "checksum": "64ed6c8c26cf527627c43499b6727ecc4e51bdab04bc019122b6ff36022fb512"}, "tedrics_data_testcases_val.json": {"num_bytes": 6420, "checksum": "cba90cde39ca5869e56c32eca517b28026ae8da56c2aadc7ff1f4af8b89f13b0"}}, "download_size": 26201, "post_processing_size": null, "dataset_size": 20447, "size_in_bytes": 46648}, "codefunctions": {"description": "", "citation": "@misc{,\n title={ },\n author={},\n year={2022}\n}\n", "homepage": "", "license": "CC BY-SA", "features": {"task_id": {"dtype": "int32", "id": null, "_type": "Value"}, "mbpp_task_id": {"dtype": "int32", "id": null, "_type": "Value"}, "description": {"dtype": "string", "id": null, "_type": "Value"}, "cot": {"dtype": "string", "id": null, "_type": "Value"}, "imports": {"dtype": "string", "id": null, "_type": "Value"}, "function_head": {"dtype": "string", "id": null, "_type": "Value"}, "function_body": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "te_dri_cs_data", "config_name": "codefunctions", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 11301, "num_examples": 15, "dataset_name": "te_dri_cs_data"}, "validation": {"name": "validation", "num_bytes": 3726, "num_examples": 5, "dataset_name": "te_dri_cs_data"}}, "download_checksums": {"tedrics_data_codefunctions.json": {"num_bytes": 13881, "checksum": "582586136d3ec42bcc870885bc46d5d358c54bca89463984b494186b704136e1"}, "tedrics_data_codefunctions_val.json": {"num_bytes": 4592, "checksum": "cc5d7a6d96e7966a14a9bd4cb4b9578e988b32f50072eadafc2c9a0d6b2970be"}}, "download_size": 18473, "post_processing_size": null, "dataset_size": 15027, "size_in_bytes": 33500}}
|
tedrics_data.py
CHANGED
@@ -15,19 +15,21 @@ _CITATION = """\
|
|
15 |
}
|
16 |
"""
|
17 |
|
18 |
-
|
19 |
|
20 |
_SUBSETS = ["tasks", "testcases", "codefunctions"]
|
21 |
|
22 |
_DATA_URLS = {
|
23 |
"tasks": {
|
24 |
-
"train":
|
25 |
},
|
26 |
"testcases": {
|
27 |
-
"train":
|
|
|
28 |
},
|
29 |
"codefunctions": {
|
30 |
-
"train":
|
|
|
31 |
}
|
32 |
}
|
33 |
|
@@ -35,7 +37,7 @@ class TeDriCSData(datasets.GeneratorBasedBuilder):
|
|
35 |
BUILDER_CONFIGS = [
|
36 |
datasets.BuilderConfig(
|
37 |
name=f"{subset}",
|
38 |
-
version=datasets.Version("1.0"),
|
39 |
description=_DESCRIPTION,
|
40 |
)
|
41 |
for subset in _SUBSETS
|
@@ -50,7 +52,7 @@ class TeDriCSData(datasets.GeneratorBasedBuilder):
|
|
50 |
"task_id": datasets.Value("int32"),
|
51 |
"mbpp_task_id": datasets.Value("int32"),
|
52 |
"source": datasets.Value("string"),
|
53 |
-
"licence": datasets.
|
54 |
"task": datasets.Value("string"),
|
55 |
}
|
56 |
)
|
@@ -65,7 +67,7 @@ class TeDriCSData(datasets.GeneratorBasedBuilder):
|
|
65 |
{
|
66 |
"test_case_id": datasets.Value("int32"),
|
67 |
"cot": datasets.Value("string"),
|
68 |
-
"input": datasets.
|
69 |
"output": datasets.Value("string")
|
70 |
}
|
71 |
)
|
@@ -79,9 +81,9 @@ class TeDriCSData(datasets.GeneratorBasedBuilder):
|
|
79 |
"mbpp_task_id": datasets.Value("int32"),
|
80 |
"description": datasets.Value("string"),
|
81 |
"cot": datasets.Value("string"),
|
82 |
-
"imports": datasets.
|
83 |
-
"function_head": datasets.
|
84 |
-
"function_body": datasets.
|
85 |
}
|
86 |
)
|
87 |
|
@@ -90,22 +92,30 @@ class TeDriCSData(datasets.GeneratorBasedBuilder):
|
|
90 |
features=features,
|
91 |
supervised_keys=None,
|
92 |
homepage=_HOMEPAGE,
|
93 |
-
license=
|
94 |
citation=_CITATION,
|
95 |
)
|
96 |
|
97 |
def _split_generators(self, dl_manager):
|
98 |
urls = _DATA_URLS[self.config.name]
|
99 |
-
data = dl_manager.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
|
101 |
return [
|
102 |
datasets.SplitGenerator(
|
103 |
name=split,
|
104 |
gen_kwargs={
|
105 |
-
"
|
106 |
},
|
107 |
)
|
108 |
-
for split in
|
109 |
]
|
110 |
|
111 |
def _generate_examples(self, filepath):
|
@@ -114,4 +124,21 @@ class TeDriCSData(datasets.GeneratorBasedBuilder):
|
|
114 |
id_ = 0
|
115 |
for sample in data:
|
116 |
yield id_, sample
|
117 |
-
id_ += 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
}
|
16 |
"""
|
17 |
|
18 |
+
_LICENSE = 'CC BY-SA'
|
19 |
|
20 |
_SUBSETS = ["tasks", "testcases", "codefunctions"]
|
21 |
|
22 |
_DATA_URLS = {
|
23 |
"tasks": {
|
24 |
+
"train": "tedrics_data_tasks.json"
|
25 |
},
|
26 |
"testcases": {
|
27 |
+
"train": "tedrics_data_testcases.json",
|
28 |
+
"validation": "tedrics_data_testcases_val.json"
|
29 |
},
|
30 |
"codefunctions": {
|
31 |
+
"train": "tedrics_data_codefunctions.json",
|
32 |
+
"validation": "tedrics_data_codefunctions_val.json"
|
33 |
}
|
34 |
}
|
35 |
|
|
|
37 |
BUILDER_CONFIGS = [
|
38 |
datasets.BuilderConfig(
|
39 |
name=f"{subset}",
|
40 |
+
version=datasets.Version("1.1.0"),
|
41 |
description=_DESCRIPTION,
|
42 |
)
|
43 |
for subset in _SUBSETS
|
|
|
52 |
"task_id": datasets.Value("int32"),
|
53 |
"mbpp_task_id": datasets.Value("int32"),
|
54 |
"source": datasets.Value("string"),
|
55 |
+
"licence": datasets.Value("string"),
|
56 |
"task": datasets.Value("string"),
|
57 |
}
|
58 |
)
|
|
|
67 |
{
|
68 |
"test_case_id": datasets.Value("int32"),
|
69 |
"cot": datasets.Value("string"),
|
70 |
+
"input": datasets.Value("string"),
|
71 |
"output": datasets.Value("string")
|
72 |
}
|
73 |
)
|
|
|
81 |
"mbpp_task_id": datasets.Value("int32"),
|
82 |
"description": datasets.Value("string"),
|
83 |
"cot": datasets.Value("string"),
|
84 |
+
"imports": datasets.Value("string"),
|
85 |
+
"function_head": datasets.Value("string"),
|
86 |
+
"function_body": datasets.Value("string")
|
87 |
}
|
88 |
)
|
89 |
|
|
|
92 |
features=features,
|
93 |
supervised_keys=None,
|
94 |
homepage=_HOMEPAGE,
|
95 |
+
license=_LICENSE,
|
96 |
citation=_CITATION,
|
97 |
)
|
98 |
|
99 |
def _split_generators(self, dl_manager):
|
100 |
urls = _DATA_URLS[self.config.name]
|
101 |
+
data = dl_manager.download_and_extract(urls)
|
102 |
+
|
103 |
+
splits = []
|
104 |
+
|
105 |
+
if self.config.name == "tasks":
|
106 |
+
splits = [datasets.Split.TRAIN]
|
107 |
+
|
108 |
+
if self.config.name == "testcases" or self.config.name == "codefunctions":
|
109 |
+
splits = [datasets.Split.TRAIN, datasets.Split.VALIDATION]
|
110 |
|
111 |
return [
|
112 |
datasets.SplitGenerator(
|
113 |
name=split,
|
114 |
gen_kwargs={
|
115 |
+
"filepath": data[split],
|
116 |
},
|
117 |
)
|
118 |
+
for split in splits
|
119 |
]
|
120 |
|
121 |
def _generate_examples(self, filepath):
|
|
|
124 |
id_ = 0
|
125 |
for sample in data:
|
126 |
yield id_, sample
|
127 |
+
id_ += 1
|
128 |
+
|
129 |
+
|
130 |
+
from datasets import load_dataset
|
131 |
+
|
132 |
+
def main():
|
133 |
+
# Zum Testen der Implementierung
|
134 |
+
dataset = load_dataset('C:\\Users\\klaud\\TeDriCSProj\\tedrics-data\\tedrics_data.py')
|
135 |
+
print(dataset["train"])
|
136 |
+
print(dataset["train"][0])
|
137 |
+
#print(dataset["validation"])
|
138 |
+
#print(dataset["validation"][0])
|
139 |
+
|
140 |
+
# Zum Generieren der dataset_infos.json (im Terminal)
|
141 |
+
# (hf-gptneox-cpu) PS C:\Users\klaud\TeDriCSProj\tedrics-data> datasets-cli test C:\Users\klaud\TeDriCSProj\tedrics-data\tedrics_data.py --save_infos --all_configs
|
142 |
+
|
143 |
+
if __name__ == "__main__":
|
144 |
+
main()
|
tedrics_data_codefunctions.json
CHANGED
@@ -25,7 +25,7 @@
|
|
25 |
"function_body": " n = len(arr)\n low = 0\n high = n - 1\n res = -1 \n while (low <= high):\n mid = (low + high) // 2 \n if arr[mid] > x:\n high = mid - 1\n elif arr[mid] < x:\n low = mid + 1\n else:\n res = mid\n low = mid + 1\n return res"
|
26 |
}, {
|
27 |
"task_id": 4,
|
28 |
-
"mbpp_task_id":
|
29 |
"description": "Write a Python function to lowercase the input text.",
|
30 |
"cot": "Given an input text. The function can be implemented with the lower() method, which returns a string in which all characters are lowercase. Symbols and Numbers are ignored.",
|
31 |
"imports": "",
|
@@ -76,6 +76,7 @@
|
|
76 |
"mbpp_task_id": 784,
|
77 |
"description": "Write a Python function to find the first even and odd number of a given list.",
|
78 |
"cot": "The function can be implemented using a generator expression and the next() function. Given a list l of numbers. Iterate over the list and find the first even number from the list, i.e. el%2==0. Then iterate over the list to find the first odd number from the list, i.e. el%2!=0. Return a tuple containing the first even and odd number. If there is no even or odd number on the list then return -1.",
|
|
|
79 |
"function_head": "def even_odd(l):\n",
|
80 |
"function_body": " first_even = next((el for el in l if el%2==0),-1)\n first_odd = next((el for el in l if el%2!=0),-1)\n return first_even, first_odd"
|
81 |
}, {
|
@@ -118,45 +119,5 @@
|
|
118 |
"imports": "",
|
119 |
"function_head": "def get_ludic(n):\n",
|
120 |
"function_body": " ludics = []\n for i in range(1, n + 1):\n ludics.append(i)\n index = 1\n while(index != len(ludics)):\n first_ludic = ludics[index]\n remove_index = index + first_ludic\n while(remove_index < len(ludics)):\n ludics.remove(ludics[remove_index])\n remove_index = remove_index + first_ludic - 1\n index += 1\n return ludics"
|
121 |
-
}, {
|
122 |
-
"task_id": 16,
|
123 |
-
"mbpp_task_id": 760,
|
124 |
-
"description": "Write a Python function to check whether a list of numbers contains only one distinct element or not.",
|
125 |
-
"cot":"Given is a list of numbers l. The check whether a list of numbers contains only one element or not can be realized using a set, since no repetitions are allowed in a set. Insert the elements of the list into the set. If there is only one element, the length of the set should be 1. In this case return True else False.",
|
126 |
-
"imports": "",
|
127 |
-
"function_head": "def unique_element(l):\n",
|
128 |
-
"function_body": " s = set(l)\n return len(s) == 1"
|
129 |
-
}, {
|
130 |
-
"task_id": 17,
|
131 |
-
"mbpp_task_id": 744,
|
132 |
-
"description": "Write a Python function to check if the given tuple has any none value or not.",
|
133 |
-
"cot":"Given a tuple t. To check if the given tuple has any none value or not can be implemented by using the functions any(), map() and lambda. The map() function iterates over each element of the given tuple and returns an iterable of the results after applying the lambda function to each item of the given tuple. The lambda function checks if an item is None. The any() function returns True if any of the elements of the returned map results are True else it returns False.",
|
134 |
-
"imports": "",
|
135 |
-
"function_head": "def check_none(test_tup):\n",
|
136 |
-
"function_body": " res = any(map(lambda ele: ele is None, test_tup))\n return res"
|
137 |
-
}, {
|
138 |
-
"task_id": 18,
|
139 |
-
"mbpp_task_id": 772,
|
140 |
-
"description": "Write a Python function to remove all the words with k length in the given string.",
|
141 |
-
"cot":"Given a string s and the length k. To remove k length words in the given string s can be realized using a list comprehension and the functions split(), join() and len(). The split() function splits a string into a list of strings after breaking the given string by the specified separator. If is not provided then any white space is a separator. Iterate over the splits with a list comprehension and omit all elements whose length differs from k, i.e. len(ele) != k. Then use the join() function to concatenate the elements of length k separated by the space character. The joined elements of length k are returned as a string.",
|
142 |
-
"imports": "",
|
143 |
-
"function_head": "def remove_length(s, k):\n",
|
144 |
-
"function_body": " temp = s.split()\n res = [ele for ele in temp if len(ele) != k]\n res = ' '.join(res)\n return (res)"
|
145 |
-
}, {
|
146 |
-
"task_id": 19,
|
147 |
-
"mbpp_task_id": 775,
|
148 |
-
"description": "Write a Python function to check whether every odd index contains odd numbers of a given list.",
|
149 |
-
"cot":"Given a list of integer numbers. To check whether every even index contains an even number and every odd index contains odd number of the input list num can be implemented using a generator expression and the modulo operator. Iterate over the indexes of the list and compare whether the index and the value stored under the index is an even or odd number. If each even index has an even value and each odd index has an odd value then return True otherwise False. Use the all() function for this. The all() function returns True if all items in an iterable are true, otherwise it returns False. If the iterable object is empty, the all() function also returns True.",
|
150 |
-
"imports": "",
|
151 |
-
"function_head": "def odd_position(nums):\n",
|
152 |
-
"function_body": " return all(nums[i]%2==i%2 for i in range(len(nums)))"
|
153 |
-
}, {
|
154 |
-
"task_id": 20,
|
155 |
-
"mbpp_task_id": 597,
|
156 |
-
"description": "Write a Python function to find kth element from the given two sorted arrays.",
|
157 |
-
"cot":"Given two sorted lists of size m and n respectively and a value k. Finding the k-th element from the given two lists of integers can be realized by using a technique based on while-loops to merge two lists. From the merged (and sorted) list the element from the k-th position can be easily determined.",
|
158 |
-
"imports": "",
|
159 |
-
"function_head": "def find_kth(arr1, arr2, k):\n",
|
160 |
-
"function_body": " m = len(arr1)\n n = len(arr2)\n sorted1 = [0] * (m + n)\n i = 0\n j = 0\n d = 0\n while (i < m and j < n):\n if (arr1[i] < arr2[j]):\n sorted1[d] = arr1[i]\n i += 1\n else:\n sorted1[d] = arr2[j]\n j += 1\n d += 1\n while (i < m):\n sorted1[d] = arr1[i]\n d += 1\n i += 1\n while (j < n):\n sorted1[d] = arr2[j]\n d += 1\n j += 1\n return sorted1[k - 1]"
|
161 |
}
|
162 |
]
|
|
|
25 |
"function_body": " n = len(arr)\n low = 0\n high = n - 1\n res = -1 \n while (low <= high):\n mid = (low + high) // 2 \n if arr[mid] > x:\n high = mid - 1\n elif arr[mid] < x:\n low = mid + 1\n else:\n res = mid\n low = mid + 1\n return res"
|
26 |
}, {
|
27 |
"task_id": 4,
|
28 |
+
"mbpp_task_id": -1,
|
29 |
"description": "Write a Python function to lowercase the input text.",
|
30 |
"cot": "Given an input text. The function can be implemented with the lower() method, which returns a string in which all characters are lowercase. Symbols and Numbers are ignored.",
|
31 |
"imports": "",
|
|
|
76 |
"mbpp_task_id": 784,
|
77 |
"description": "Write a Python function to find the first even and odd number of a given list.",
|
78 |
"cot": "The function can be implemented using a generator expression and the next() function. Given a list l of numbers. Iterate over the list and find the first even number from the list, i.e. el%2==0. Then iterate over the list to find the first odd number from the list, i.e. el%2!=0. Return a tuple containing the first even and odd number. If there is no even or odd number on the list then return -1.",
|
79 |
+
"imports": "",
|
80 |
"function_head": "def even_odd(l):\n",
|
81 |
"function_body": " first_even = next((el for el in l if el%2==0),-1)\n first_odd = next((el for el in l if el%2!=0),-1)\n return first_even, first_odd"
|
82 |
}, {
|
|
|
119 |
"imports": "",
|
120 |
"function_head": "def get_ludic(n):\n",
|
121 |
"function_body": " ludics = []\n for i in range(1, n + 1):\n ludics.append(i)\n index = 1\n while(index != len(ludics)):\n first_ludic = ludics[index]\n remove_index = index + first_ludic\n while(remove_index < len(ludics)):\n ludics.remove(ludics[remove_index])\n remove_index = remove_index + first_ludic - 1\n index += 1\n return ludics"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
}
|
123 |
]
|
tedrics_data_codefunctions_val.json
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[{
|
2 |
+
"task_id": 16,
|
3 |
+
"mbpp_task_id": 760,
|
4 |
+
"description": "Write a Python function to check whether a list of numbers contains only one distinct element or not.",
|
5 |
+
"cot":"Given is a list of numbers l. The check whether a list of numbers contains only one element or not can be realized using a set, since no repetitions are allowed in a set. Insert the elements of the list into the set. If there is only one element, the length of the set should be 1. In this case return True else False.",
|
6 |
+
"imports": "",
|
7 |
+
"function_head": "def unique_element(l):\n",
|
8 |
+
"function_body": " s = set(l)\n return len(s) == 1"
|
9 |
+
}, {
|
10 |
+
"task_id": 17,
|
11 |
+
"mbpp_task_id": 744,
|
12 |
+
"description": "Write a Python function to check if the given tuple has any none value or not.",
|
13 |
+
"cot":"Given a tuple t. To check if the given tuple has any none value or not can be implemented by using the functions any(), map() and lambda. The map() function iterates over each element of the given tuple and returns an iterable of the results after applying the lambda function to each item of the given tuple. The lambda function checks if an item is None. The any() function returns True if any of the elements of the returned map results are True else it returns False.",
|
14 |
+
"imports": "",
|
15 |
+
"function_head": "def check_none(test_tup):\n",
|
16 |
+
"function_body": " res = any(map(lambda ele: ele is None, test_tup))\n return res"
|
17 |
+
}, {
|
18 |
+
"task_id": 18,
|
19 |
+
"mbpp_task_id": 772,
|
20 |
+
"description": "Write a Python function to remove all the words with k length in the given string.",
|
21 |
+
"cot":"Given a string s and the length k. To remove k length words in the given string s can be realized using a list comprehension and the functions split(), join() and len(). The split() function splits a string into a list of strings after breaking the given string by the specified separator. If is not provided then any white space is a separator. Iterate over the splits with a list comprehension and omit all elements whose length differs from k, i.e. len(ele) != k. Then use the join() function to concatenate the elements of length k separated by the space character. The joined elements of length k are returned as a string.",
|
22 |
+
"imports": "",
|
23 |
+
"function_head": "def remove_length(s, k):\n",
|
24 |
+
"function_body": " temp = s.split()\n res = [ele for ele in temp if len(ele) != k]\n res = ' '.join(res)\n return (res)"
|
25 |
+
}, {
|
26 |
+
"task_id": 19,
|
27 |
+
"mbpp_task_id": 775,
|
28 |
+
"description": "Write a Python function to check whether every odd index contains odd numbers of a given list.",
|
29 |
+
"cot":"Given a list of integer numbers. To check whether every even index contains an even number and every odd index contains odd number of the input list num can be implemented using a generator expression and the modulo operator. Iterate over the indexes of the list and compare whether the index and the value stored under the index is an even or odd number. If each even index has an even value and each odd index has an odd value then return True otherwise False. Use the all() function for this. The all() function returns True if all items in an iterable are true, otherwise it returns False. If the iterable object is empty, the all() function also returns True.",
|
30 |
+
"imports": "",
|
31 |
+
"function_head": "def odd_position(nums):\n",
|
32 |
+
"function_body": " return all(nums[i]%2==i%2 for i in range(len(nums)))"
|
33 |
+
}, {
|
34 |
+
"task_id": 20,
|
35 |
+
"mbpp_task_id": 597,
|
36 |
+
"description": "Write a Python function to find kth element from the given two sorted arrays.",
|
37 |
+
"cot":"Given two sorted lists of size m and n respectively and a value k. Finding the k-th element from the given two lists of integers can be realized by using a technique based on while-loops to merge two lists. From the merged (and sorted) list the element from the k-th position can be easily determined.",
|
38 |
+
"imports": "",
|
39 |
+
"function_head": "def find_kth(arr1, arr2, k):\n",
|
40 |
+
"function_body": " m = len(arr1)\n n = len(arr2)\n sorted1 = [0] * (m + n)\n i = 0\n j = 0\n d = 0\n while (i < m and j < n):\n if (arr1[i] < arr2[j]):\n sorted1[d] = arr1[i]\n i += 1\n else:\n sorted1[d] = arr2[j]\n j += 1\n d += 1\n while (i < m):\n sorted1[d] = arr1[i]\n d += 1\n i += 1\n while (j < n):\n sorted1[d] = arr2[j]\n d += 1\n j += 1\n return sorted1[k - 1]"
|
41 |
+
}
|
42 |
+
]
|
tedrics_data_tasks.json
CHANGED
@@ -19,7 +19,7 @@
|
|
19 |
"task": "Find the position of last occurrences of an element in a sorted array."
|
20 |
}, {
|
21 |
"task_id": 4,
|
22 |
-
"mbpp_task_id":
|
23 |
"source": "https://www.geeksforgeeks.org/text-preprocessing-in-python-set-1/",
|
24 |
"licence": "CC BY-SA",
|
25 |
"task": "Lowercase the given input text."
|
|
|
19 |
"task": "Find the position of last occurrences of an element in a sorted array."
|
20 |
}, {
|
21 |
"task_id": 4,
|
22 |
+
"mbpp_task_id": -1,
|
23 |
"source": "https://www.geeksforgeeks.org/text-preprocessing-in-python-set-1/",
|
24 |
"licence": "CC BY-SA",
|
25 |
"task": "Lowercase the given input text."
|
tedrics_data_testcases.json
CHANGED
@@ -76,7 +76,7 @@
|
|
76 |
},
|
77 |
{
|
78 |
"task_id": 4,
|
79 |
-
"mbpp_task_id":
|
80 |
"task": "Lowercase the given input text.",
|
81 |
"test_cases": [
|
82 |
{
|
@@ -373,130 +373,5 @@
|
|
373 |
"output": "[1, 2, 3, 5]"
|
374 |
}
|
375 |
]
|
376 |
-
},
|
377 |
-
{
|
378 |
-
"task_id": 16,
|
379 |
-
"mbpp_task_id": 760,
|
380 |
-
"task": "Check whether a list of numbers contains only one distinct element or not.",
|
381 |
-
"test_cases": [
|
382 |
-
{
|
383 |
-
"test_case_id": 1,
|
384 |
-
"cot": "Given a list of numbers l = [1,2,1,2]. The list consists of two distinct numbers, namely 1 and 2. The output is False.",
|
385 |
-
"input": "[[1,2,1,2]]",
|
386 |
-
"output": "False"
|
387 |
-
},
|
388 |
-
{
|
389 |
-
"test_case_id": 2,
|
390 |
-
"cot": "Given a list of numbers l = [1,2,3,4,5]. The list consists of five distinct numbers, namely 1, 2, 3, 4 and 5. The output is False.",
|
391 |
-
"input": "[[1,2,3,4,5]]",
|
392 |
-
"output": "False"
|
393 |
-
},
|
394 |
-
{
|
395 |
-
"test_case_id": 3,
|
396 |
-
"cot": "Given a list of numbers l = [1,1,1]. The list consists of one distinct numbers, namely 1. The output is True.",
|
397 |
-
"input": "[[1,1,1]]",
|
398 |
-
"output": "True"
|
399 |
-
}
|
400 |
-
]
|
401 |
-
},
|
402 |
-
{
|
403 |
-
"task_id": 17,
|
404 |
-
"mbpp_task_id": 744,
|
405 |
-
"task": "Check if the given tuple has any none value or not.",
|
406 |
-
"test_cases": [
|
407 |
-
{
|
408 |
-
"test_case_id": 1,
|
409 |
-
"cot": "Given a tuple t = (10, 4, 5, 6, None). The tuple has five elements, namely four numbers, 10, 4, 5 and 6, and one None element. The output is True.",
|
410 |
-
"input": "[(10, 4, 5, 6, None)]",
|
411 |
-
"output": "True"
|
412 |
-
},
|
413 |
-
{
|
414 |
-
"test_case_id": 2,
|
415 |
-
"cot": "Given a tuple t = (7, 8, 9, 11, 14). The tuple has five elements, namely the five numbers 7, 8, 9, 11 and 14, but no None element. The output is False.",
|
416 |
-
"input": "[(7, 8, 9, 11, 14)]",
|
417 |
-
"output": "False"
|
418 |
-
},
|
419 |
-
{
|
420 |
-
"test_case_id": 3,
|
421 |
-
"cot": "Given a tuple t = (1, 2, 3, 4, None). The tuple has five elements, namely the four numbers 1, 2, 3 and 4, and one None element. The output is True.",
|
422 |
-
"input": "[(1, 2, 3, 4, None)]",
|
423 |
-
"output": "True"
|
424 |
-
}
|
425 |
-
]
|
426 |
-
},
|
427 |
-
{
|
428 |
-
"task_id": 18,
|
429 |
-
"mbpp_task_id": 772,
|
430 |
-
"task": "Remove all the words with k length in the given string.",
|
431 |
-
"test_cases": [
|
432 |
-
{
|
433 |
-
"test_case_id": 1,
|
434 |
-
"cot": "Given a string s='The person is most value tet' and the length k=3. The strings 'person', 'is', 'most' and 'value' have lengths different from k, i.e. len('person') = 6 and 6!=3, len('is') = 2 and 6!=3, len('most') = 4 and 4!=3, len('value') = 5 and 5!=3. The strings 'The' and 'tet' have the length K=3 and are removed from the input string s. The output is 'person is most value'.",
|
435 |
-
"input": "['The person is most value tet', 3]",
|
436 |
-
"output": "'person is most value'"
|
437 |
-
},
|
438 |
-
{
|
439 |
-
"test_case_id": 2,
|
440 |
-
"cot": "Given a string s='If you told me about this ok' and the length k=4. The strings 'If', 'you', 'me', 'about' and 'ok' have lengths different from k, i.e. len('If') = 2 and 2!=4, len('you') = 3 and 3!=4, len('me') = 2 and 2!=4, len('about') = 5 and 5!=4, len('ok') = 2 and 2!=4. The strings 'told' and 'this' have the length K=4 and are removed from the input string s. The output is 'If you me about ok'.",
|
441 |
-
"input": "['If you told me about this ok', 4]",
|
442 |
-
"output": "'If you me about ok'"
|
443 |
-
},
|
444 |
-
{
|
445 |
-
"test_case_id": 3,
|
446 |
-
"cot": "Given a string s='Forces of darkeness' and the length k=4. The strings 'Forces', 'of' and 'darkeness' have lengths different from k, i.e. len('Forces') = 6 and 6!=4, len('of') = 2 and 2!=4, len('darkeness') = 9 and 9!=4. There are no strings that have the length K=4. The output is 'Forces of darkeness'.",
|
447 |
-
"input": "['Forces of darkeness', 4]",
|
448 |
-
"output": "'Forces of darkeness'"
|
449 |
-
}
|
450 |
-
]
|
451 |
-
},
|
452 |
-
{
|
453 |
-
"task_id": 19,
|
454 |
-
"mbpp_task_id": 775,
|
455 |
-
"task": "Check whether every odd index contains odd numbers of a given list.",
|
456 |
-
"test_cases": [
|
457 |
-
{
|
458 |
-
"test_case_id": 1,
|
459 |
-
"cot": "Given a list of integer numbers num=[2,1,4,3]. The index 0 is even and the value 2 stored under the index 0 is even, i.e. 2%2=0%2=0. The index 1 is odd and the value 1 stored under the index 1 is odd, i.e. 1%2=1%2=1. The index 4 is even and the value 4 stored under the index 2 is even, i.e. 4%2=2%2=0. The index 3 is odd and the value 3 stored under the index 3 is odd, i.e. 3%2=3%2=1. Each even index has an even value and each odd index has an odd value. The output is True.",
|
460 |
-
"input": "[[2,1,4,3]]",
|
461 |
-
"output": "True"
|
462 |
-
},
|
463 |
-
{
|
464 |
-
"test_case_id": 2,
|
465 |
-
"cot": "Given a list of integer numbers num=[4,1,2]. The index 0 is even and the value 4 stored under the index 0 is even, i.e. 4%2=0%2=0. The index 1 is odd and the value 1 stored under the index 1 is odd, i.e. 1%2=1%2=1. The index 2 is even and the value 2 stored under the index 2 is even, i.e. 2%2=2%2=0. Each even index has an even value and each odd index has an odd value. The output is True.",
|
466 |
-
"input": "[[4,1,2]]",
|
467 |
-
"output": "True"
|
468 |
-
},
|
469 |
-
{
|
470 |
-
"test_case_id": 3,
|
471 |
-
"cot": "Given a list of integer numbers num=[1,2,3]. The index 0 is even and the value 1 stored under the index 0 is odd, i.e. 1%2=1 and 0%2=0. The index 1 is odd and the value 2 stored under the index 1 is even, i.e. 2%2=0 and 1%2=1. The index 2 is even and the value 3 stored under the index 2 is odd, i.e. 3%2=1 and 2%2=0. No even index has an even value and no odd index has an odd value. The output is False.",
|
472 |
-
"input": "[[1,2,3]]",
|
473 |
-
"output": "False"
|
474 |
-
}
|
475 |
-
]
|
476 |
-
},
|
477 |
-
{
|
478 |
-
"task_id": 20,
|
479 |
-
"mbpp_task_id": 597,
|
480 |
-
"task": "Find kth element from the given two sorted arrays.",
|
481 |
-
"test_cases": [
|
482 |
-
{
|
483 |
-
"test_case_id": 1,
|
484 |
-
"cot": "Given two sorted lists of integer numbers [2, 3, 6, 7, 9] and [1, 4, 8, 10] and the value k = 5. The merged list of the two input lists is [1, 2, 3, 4, 6, 7, 8, 9, 10]. The 6-th element is 6. The output is 6.",
|
485 |
-
"input": "[[2, 3, 6, 7, 9], [1, 4, 8, 10], 5]",
|
486 |
-
"output": "6"
|
487 |
-
},
|
488 |
-
{
|
489 |
-
"test_case_id": 2,
|
490 |
-
"cot": "Given two sorted lists of integer numbers [100, 112, 256, 349, 770] and [72, 86, 113, 119, 265, 445, 892] and the value k = 7. The merged list of the two input lists is [72, 86, 100, 112, 113, 119, 256, 265, 349, 445, 892]. The 7-th element is 256. The output is 256.",
|
491 |
-
"input": "[[100, 112, 256, 349, 770], [72, 86, 113, 119, 265, 445, 892], 7]",
|
492 |
-
"output": "256"
|
493 |
-
},
|
494 |
-
{
|
495 |
-
"test_case_id": 3,
|
496 |
-
"cot": "Given two sorted lists of integer numbers [3, 4, 7, 8, 10] and [2, 5, 9, 11] and the value k = 6. The merged list of the two input lists is [2, 3, 4, 5, 7, 8, 9, 10, 11]. The 6-th element is 8. The output is 8.",
|
497 |
-
"input": "[[3, 4, 7, 8, 10], [2, 5, 9, 11], 6]",
|
498 |
-
"output": "8"
|
499 |
-
}
|
500 |
-
]
|
501 |
}
|
502 |
]
|
|
|
76 |
},
|
77 |
{
|
78 |
"task_id": 4,
|
79 |
+
"mbpp_task_id": -1,
|
80 |
"task": "Lowercase the given input text.",
|
81 |
"test_cases": [
|
82 |
{
|
|
|
373 |
"output": "[1, 2, 3, 5]"
|
374 |
}
|
375 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
376 |
}
|
377 |
]
|
tedrics_data_testcases_val.json
ADDED
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[
|
2 |
+
{
|
3 |
+
"task_id": 16,
|
4 |
+
"mbpp_task_id": 760,
|
5 |
+
"task": "Check whether a list of numbers contains only one distinct element or not.",
|
6 |
+
"test_cases": [
|
7 |
+
{
|
8 |
+
"test_case_id": 1,
|
9 |
+
"cot": "Given a list of numbers l = [1,2,1,2]. The list consists of two distinct numbers, namely 1 and 2. The output is False.",
|
10 |
+
"input": "[[1,2,1,2]]",
|
11 |
+
"output": "False"
|
12 |
+
},
|
13 |
+
{
|
14 |
+
"test_case_id": 2,
|
15 |
+
"cot": "Given a list of numbers l = [1,2,3,4,5]. The list consists of five distinct numbers, namely 1, 2, 3, 4 and 5. The output is False.",
|
16 |
+
"input": "[[1,2,3,4,5]]",
|
17 |
+
"output": "False"
|
18 |
+
},
|
19 |
+
{
|
20 |
+
"test_case_id": 3,
|
21 |
+
"cot": "Given a list of numbers l = [1,1,1]. The list consists of one distinct numbers, namely 1. The output is True.",
|
22 |
+
"input": "[[1,1,1]]",
|
23 |
+
"output": "True"
|
24 |
+
}
|
25 |
+
]
|
26 |
+
},
|
27 |
+
{
|
28 |
+
"task_id": 17,
|
29 |
+
"mbpp_task_id": 744,
|
30 |
+
"task": "Check if the given tuple has any none value or not.",
|
31 |
+
"test_cases": [
|
32 |
+
{
|
33 |
+
"test_case_id": 1,
|
34 |
+
"cot": "Given a tuple t = (10, 4, 5, 6, None). The tuple has five elements, namely four numbers, 10, 4, 5 and 6, and one None element. The output is True.",
|
35 |
+
"input": "[(10, 4, 5, 6, None)]",
|
36 |
+
"output": "True"
|
37 |
+
},
|
38 |
+
{
|
39 |
+
"test_case_id": 2,
|
40 |
+
"cot": "Given a tuple t = (7, 8, 9, 11, 14). The tuple has five elements, namely the five numbers 7, 8, 9, 11 and 14, but no None element. The output is False.",
|
41 |
+
"input": "[(7, 8, 9, 11, 14)]",
|
42 |
+
"output": "False"
|
43 |
+
},
|
44 |
+
{
|
45 |
+
"test_case_id": 3,
|
46 |
+
"cot": "Given a tuple t = (1, 2, 3, 4, None). The tuple has five elements, namely the four numbers 1, 2, 3 and 4, and one None element. The output is True.",
|
47 |
+
"input": "[(1, 2, 3, 4, None)]",
|
48 |
+
"output": "True"
|
49 |
+
}
|
50 |
+
]
|
51 |
+
},
|
52 |
+
{
|
53 |
+
"task_id": 18,
|
54 |
+
"mbpp_task_id": 772,
|
55 |
+
"task": "Remove all the words with k length in the given string.",
|
56 |
+
"test_cases": [
|
57 |
+
{
|
58 |
+
"test_case_id": 1,
|
59 |
+
"cot": "Given a string s='The person is most value tet' and the length k=3. The strings 'person', 'is', 'most' and 'value' have lengths different from k, i.e. len('person') = 6 and 6!=3, len('is') = 2 and 6!=3, len('most') = 4 and 4!=3, len('value') = 5 and 5!=3. The strings 'The' and 'tet' have the length K=3 and are removed from the input string s. The output is 'person is most value'.",
|
60 |
+
"input": "['The person is most value tet', 3]",
|
61 |
+
"output": "'person is most value'"
|
62 |
+
},
|
63 |
+
{
|
64 |
+
"test_case_id": 2,
|
65 |
+
"cot": "Given a string s='If you told me about this ok' and the length k=4. The strings 'If', 'you', 'me', 'about' and 'ok' have lengths different from k, i.e. len('If') = 2 and 2!=4, len('you') = 3 and 3!=4, len('me') = 2 and 2!=4, len('about') = 5 and 5!=4, len('ok') = 2 and 2!=4. The strings 'told' and 'this' have the length K=4 and are removed from the input string s. The output is 'If you me about ok'.",
|
66 |
+
"input": "['If you told me about this ok', 4]",
|
67 |
+
"output": "'If you me about ok'"
|
68 |
+
},
|
69 |
+
{
|
70 |
+
"test_case_id": 3,
|
71 |
+
"cot": "Given a string s='Forces of darkeness' and the length k=4. The strings 'Forces', 'of' and 'darkeness' have lengths different from k, i.e. len('Forces') = 6 and 6!=4, len('of') = 2 and 2!=4, len('darkeness') = 9 and 9!=4. There are no strings that have the length K=4. The output is 'Forces of darkeness'.",
|
72 |
+
"input": "['Forces of darkeness', 4]",
|
73 |
+
"output": "'Forces of darkeness'"
|
74 |
+
}
|
75 |
+
]
|
76 |
+
},
|
77 |
+
{
|
78 |
+
"task_id": 19,
|
79 |
+
"mbpp_task_id": 775,
|
80 |
+
"task": "Check whether every odd index contains odd numbers of a given list.",
|
81 |
+
"test_cases": [
|
82 |
+
{
|
83 |
+
"test_case_id": 1,
|
84 |
+
"cot": "Given a list of integer numbers num=[2,1,4,3]. The index 0 is even and the value 2 stored under the index 0 is even, i.e. 2%2=0%2=0. The index 1 is odd and the value 1 stored under the index 1 is odd, i.e. 1%2=1%2=1. The index 4 is even and the value 4 stored under the index 2 is even, i.e. 4%2=2%2=0. The index 3 is odd and the value 3 stored under the index 3 is odd, i.e. 3%2=3%2=1. Each even index has an even value and each odd index has an odd value. The output is True.",
|
85 |
+
"input": "[[2,1,4,3]]",
|
86 |
+
"output": "True"
|
87 |
+
},
|
88 |
+
{
|
89 |
+
"test_case_id": 2,
|
90 |
+
"cot": "Given a list of integer numbers num=[4,1,2]. The index 0 is even and the value 4 stored under the index 0 is even, i.e. 4%2=0%2=0. The index 1 is odd and the value 1 stored under the index 1 is odd, i.e. 1%2=1%2=1. The index 2 is even and the value 2 stored under the index 2 is even, i.e. 2%2=2%2=0. Each even index has an even value and each odd index has an odd value. The output is True.",
|
91 |
+
"input": "[[4,1,2]]",
|
92 |
+
"output": "True"
|
93 |
+
},
|
94 |
+
{
|
95 |
+
"test_case_id": 3,
|
96 |
+
"cot": "Given a list of integer numbers num=[1,2,3]. The index 0 is even and the value 1 stored under the index 0 is odd, i.e. 1%2=1 and 0%2=0. The index 1 is odd and the value 2 stored under the index 1 is even, i.e. 2%2=0 and 1%2=1. The index 2 is even and the value 3 stored under the index 2 is odd, i.e. 3%2=1 and 2%2=0. No even index has an even value and no odd index has an odd value. The output is False.",
|
97 |
+
"input": "[[1,2,3]]",
|
98 |
+
"output": "False"
|
99 |
+
}
|
100 |
+
]
|
101 |
+
},
|
102 |
+
{
|
103 |
+
"task_id": 20,
|
104 |
+
"mbpp_task_id": 597,
|
105 |
+
"task": "Find kth element from the given two sorted arrays.",
|
106 |
+
"test_cases": [
|
107 |
+
{
|
108 |
+
"test_case_id": 1,
|
109 |
+
"cot": "Given two sorted lists of integer numbers [2, 3, 6, 7, 9] and [1, 4, 8, 10] and the value k = 5. The merged list of the two input lists is [1, 2, 3, 4, 6, 7, 8, 9, 10]. The 6-th element is 6. The output is 6.",
|
110 |
+
"input": "[[2, 3, 6, 7, 9], [1, 4, 8, 10], 5]",
|
111 |
+
"output": "6"
|
112 |
+
},
|
113 |
+
{
|
114 |
+
"test_case_id": 2,
|
115 |
+
"cot": "Given two sorted lists of integer numbers [100, 112, 256, 349, 770] and [72, 86, 113, 119, 265, 445, 892] and the value k = 7. The merged list of the two input lists is [72, 86, 100, 112, 113, 119, 256, 265, 349, 445, 892]. The 7-th element is 256. The output is 256.",
|
116 |
+
"input": "[[100, 112, 256, 349, 770], [72, 86, 113, 119, 265, 445, 892], 7]",
|
117 |
+
"output": "256"
|
118 |
+
},
|
119 |
+
{
|
120 |
+
"test_case_id": 3,
|
121 |
+
"cot": "Given two sorted lists of integer numbers [3, 4, 7, 8, 10] and [2, 5, 9, 11] and the value k = 6. The merged list of the two input lists is [2, 3, 4, 5, 7, 8, 9, 10, 11]. The 6-th element is 8. The output is 8.",
|
122 |
+
"input": "[[3, 4, 7, 8, 10], [2, 5, 9, 11], 6]",
|
123 |
+
"output": "8"
|
124 |
+
}
|
125 |
+
]
|
126 |
+
}
|
127 |
+
]
|