MCPcopy Create free account
hub / github.com/LHRLAB/ChatKBQA / parse_s_expr

Function parse_s_expr

components/expr_parser.py:233–240  ·  view source on GitHub ↗
(expr)

Source from the content-addressed store, hash-verified

231
232# top lvel: and, arg, count, cant be JOIN, LE, R
233def parse_s_expr(expr):
234 tokens = tokenize_s_expr(expr)
235 # assert tokens[0] == '(' and tokens[-1] == ')'
236 # tokens = tokens[1:-1]
237 ast, cursor = _consume_a_node(tokens, 0, 'unary')
238 assert cursor == len(tokens)
239 assert ' '.join(tokens) == ast.logical_form()
240 return ast
241
242def textualize_s_expr(expr):
243 ast = parse_s_expr(expr)

Callers 3

textualize_s_exprFunction · 0.85
test_text_converterFunction · 0.85

Calls 3

_consume_a_nodeFunction · 0.85
logical_formMethod · 0.80
tokenize_s_exprFunction · 0.70

Tested by 1

test_text_converterFunction · 0.68