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

Method build

components/expr_parser.py:43–61  ·  view source on GitHub ↗
(cls, tok, data_type, fields)

Source from the content-addressed store, hash-verified

41
42 @classmethod
43 def build(cls, tok, data_type, fields):
44 if tok == 'AND':
45 return AndNode(data_type, fields)
46 elif tok == 'R':
47 return RNode(data_type, fields)
48 elif tok == 'COUNT':
49 return CountNode(data_type, fields)
50 elif tok == 'JOIN':
51 return JoinNode(data_type, fields)
52 elif tok in ['le', 'lt', 'ge', 'gt']:
53 return CompNode(tok, data_type, fields)
54 elif tok in ['ARGMIN', 'ARGMAX']:
55 return ArgNode(tok, data_type, fields)
56 elif tok.startswith('m.'):
57 return EntityNode(tok, data_type, fields)
58 elif '^^http://www.w3.org/2001/XMLSchema' in tok:
59 return ValNode(tok, data_type, fields)
60 else:
61 return SchemaNode(tok, data_type, fields)
62
63 def logical_form(self):
64 if self.depth == 0:

Callers 1

_consume_a_nodeFunction · 0.80

Calls 9

AndNodeClass · 0.85
RNodeClass · 0.85
CountNodeClass · 0.85
JoinNodeClass · 0.85
CompNodeClass · 0.85
ArgNodeClass · 0.85
EntityNodeClass · 0.85
ValNodeClass · 0.85
SchemaNodeClass · 0.85

Tested by

no test coverage detected