convert a webqsp parse instance to a s_expr
(parse)
| 605 | |
| 606 | |
| 607 | def convert_parse_instance(parse): |
| 608 | """convert a webqsp parse instance to a s_expr""" |
| 609 | sparql = parse['Sparql'] |
| 610 | # print(parse.keys()) |
| 611 | # print(parse['PotentialTopicEntityMention']) |
| 612 | # print(parse['TopicEntityMid'], parse['TopicEntityName']) |
| 613 | try: |
| 614 | s_expr = parser.parse_query(sparql, parse['TopicEntityMid']) |
| 615 | # print('---GOOD------') |
| 616 | # print(sparql) |
| 617 | # print(s_expr) |
| 618 | except AssertionError: |
| 619 | s_expr = 'null' |
| 620 | # print(parse['']) |
| 621 | parse['SExpr'] = s_expr |
| 622 | return parse, s_expr != 'null' |
| 623 | |
| 624 | |
| 625 | def webq_s_expr_to_sparql_query(s_expr): |
nothing calls this directly
no outgoing calls
no test coverage detected