Datasets:
Task 1, 3, 4
Browse files- openpi_v2.py +20 -8
openpi_v2.py
CHANGED
|
@@ -237,23 +237,35 @@ class OpenpiV2(datasets.GeneratorBasedBuilder):
|
|
| 237 |
]
|
| 238 |
|
| 239 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 240 |
def find_change(key, dataset):
|
| 241 |
res = []
|
| 242 |
|
| 243 |
for state in dataset:
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
for step in state["answers"]:
|
| 247 |
-
if len(step) > 0:
|
| 248 |
-
flag = True
|
| 249 |
-
break
|
| 250 |
-
|
| 251 |
-
if flag:
|
| 252 |
list_key = state[key].split(" | ")
|
| 253 |
res.append([el for el in list_key])
|
| 254 |
|
| 255 |
return (res)
|
| 256 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 257 |
|
| 258 |
def _generate_examples(self, filepath):
|
| 259 |
logger.info("generating examples from = %s", filepath)
|
|
|
|
| 237 |
]
|
| 238 |
|
| 239 |
|
| 240 |
+
@staticmethod
|
| 241 |
+
def change_occur(dataset):
|
| 242 |
+
for step in dataset["answers"]:
|
| 243 |
+
if len(step) > 0:
|
| 244 |
+
return True
|
| 245 |
+
|
| 246 |
+
return False
|
| 247 |
+
|
| 248 |
+
@staticmethod
|
| 249 |
def find_change(key, dataset):
|
| 250 |
res = []
|
| 251 |
|
| 252 |
for state in dataset:
|
| 253 |
+
if change_occur(state["answers"]):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 254 |
list_key = state[key].split(" | ")
|
| 255 |
res.append([el for el in list_key])
|
| 256 |
|
| 257 |
return (res)
|
| 258 |
|
| 259 |
+
@staticmethod
|
| 260 |
+
def find_attr_entity_change(dataset):
|
| 261 |
+
attr_change = []
|
| 262 |
+
|
| 263 |
+
for state in dataset:
|
| 264 |
+
if change_occur(state["answers"]):
|
| 265 |
+
change_str = "[" + state["attribute"] + "] of [" + state["entity"] + "] changed"
|
| 266 |
+
attr_change.append(attr_change)
|
| 267 |
+
|
| 268 |
+
return attr_change
|
| 269 |
|
| 270 |
def _generate_examples(self, filepath):
|
| 271 |
logger.info("generating examples from = %s", filepath)
|