MCPcopy Create free account
hub / github.com/PaddlePaddle/Research / join_by_col

Function join_by_col

NLP/Text2SQL-BASELINE/tools/evaluation/utils.py:124–139  ·  view source on GitHub ↗
(toks, cols)

Source from the content-addressed store, hash-verified

122 return new_toks
123
124 def join_by_col(toks, cols):
125 new_toks = []
126 _len = len(toks)
127 i = 0
128 while i < _len-1:
129 merge = False
130 for j in range(10):
131 if ''.join(toks[i:i+j]) in cols:
132 new_toks.append(''.join(toks[i:i+j]))
133 i += j
134 merge = True
135 if not merge:
136 new_toks.append(toks[i])
137 i += 1
138 new_toks.append(toks[-1])
139 return new_toks
140
141 tokens_tmp = _extract_value(string)
142

Callers 1

tokenize_NL2SQLFunction · 0.85

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected