()
| 266 | return ' '.join(norm_toks) |
| 267 | |
| 268 | def test_text_converter(): |
| 269 | # dataset = load_json('outputs/grailqa_v1.0_dev.json') |
| 270 | dataset = load_json('outputs/grailqa_v1.0_train.json') |
| 271 | import random |
| 272 | random.seed(123) |
| 273 | random.shuffle(dataset) |
| 274 | |
| 275 | templates = set() |
| 276 | for i, data in enumerate(dataset[:100]): |
| 277 | s_expr = data['s_expression'] |
| 278 | question = data['question'] |
| 279 | ast = parse_s_expr(data['s_expression']) |
| 280 | skeleton = ast.skeleton_form() |
| 281 | templates.add(skeleton) |
| 282 | textual_expr = ast.textual_form() |
| 283 | |
| 284 | simplified_expr = simplify_textual_form(textual_expr) |
| 285 | # if ('AND' in skeleton): |
| 286 | # sim_skeleton = skeleton.replace('AND SCHEMA', '') |
| 287 | # if 'AND' in sim_skeleton: |
| 288 | # print('------------------------------') |
| 289 | # print(question) |
| 290 | # print(s_expr) |
| 291 | # if ('COMP' in skeleton): |
| 292 | print(f'----------------{i}--------------') |
| 293 | print(question) |
| 294 | print(s_expr) |
| 295 | print(textual_expr) |
| 296 | print(simplified_expr) |
| 297 | |
| 298 | # print(len(templates)) |
| 299 | # for t in templates: |
| 300 | # if 'COMP' in t: |
| 301 | # print(t) |
| 302 | # # if 'ARG' in t: |
| 303 | # # print(t) |
| 304 |
nothing calls this directly
no test coverage detected