(g_wvi, sql_i, i_hds, i_sql_vocab, col_pool_type)
return g_pnt_idxs
sql_vocab = (
        0.. "sql none", "sql max", "sql min", "sql count", "sql sum", "sql average", ..5
        6.. "sql select", "sql where", "sql and", .. 8
        9.. "sql equal", "sql greater than", "sql less than", .. 11
        12.. "sql start", "sql end" .. 13
    )
sql_vocab = (
        0.. "sql none", "sql max", "sql min", "sql count", "sql sum", "sql average", ..5
        6.. "sql select", "sql where", "sql and", .. 8
        9.. "sql equal", "sql greater than", "sql less than", .. 11
        12.. "sql start", "sql end" .. 13
    )
sql_vocab = ( 0 .. sql none sql max sql min sql count sql sum sql average .. 5 6 .. sql select sql where sql and .. 8 9 .. sql equal sql greater than sql less than .. 11 12 .. sql start sql end .. 13 )
def gen_g_pnt_idx(g_wvi, sql_i, i_hds, i_sql_vocab, col_pool_type):
    """
    sql_vocab = (
        0.. "sql none", "sql max", "sql min", "sql count", "sql sum", "sql average", ..5
        6.. "sql select", "sql where", "sql and", .. 8
        9.. "sql equal", "sql greater than", "sql less than", .. 11
        12.. "sql start", "sql end" .. 13
    )
    """
    g_pnt_idxs = []



    for b, sql_i1 in enumerate(sql_i):
        i_sql_vocab1 = i_sql_vocab[b]
        i_hds1 = i_hds[b]
        g_pnt_idxs1 = []

        # start token
        pnt_idx1 = get_pnt_idx1(col_pool_type, i_sql_vocab1[-2])
        g_pnt_idxs1.append(pnt_idx1)

        # select token
        pnt_idx1 = get_pnt_idx1(col_pool_type, i_sql_vocab1[6])
        g_pnt_idxs1.append(pnt_idx1)

        # select agg
        idx_agg = sql_i1["agg"]
        pnt_idx1 = get_pnt_idx1(col_pool_type, i_sql_vocab1[idx_agg])
        g_pnt_idxs1.append(pnt_idx1)

        # select column
        idx_sc = sql_i1["sel"]
        pnt_idx1 = get_pnt_idx1(col_pool_type, i_hds1[idx_sc])
        g_pnt_idxs1.append(pnt_idx1)

        conds = sql_i1["conds"]
        wn = len(conds)
        if wn <= 0:
            pass
        else:
            # select where
            pnt_idx1 = get_pnt_idx1(col_pool_type, i_sql_vocab1[7])
            g_pnt_idxs1.append(pnt_idx1)

            for i_wn, conds1 in enumerate(conds):
                # where column
                idx_wc = conds1[0]
                pnt_idx1 = get_pnt_idx1(col_pool_type, i_hds1[idx_wc])
                g_pnt_idxs1.append(pnt_idx1)

                # where op
                idx_wo = conds1[1]
                pnt_idx1 = get_pnt_idx1(col_pool_type, i_sql_vocab1[idx_wo + 9])
                g_pnt_idxs1.append(pnt_idx1)

                # where val
                st, ed = g_wvi[b][i_wn]
                end_pos_of_sql_vocab = i_sql_vocab1[-1][-1]
                g_pnt_idxs1.append(st + 1 + end_pos_of_sql_vocab)  # due to inital [CLS] token in BERT-input vector
                g_pnt_idxs1.append(ed + 1 + end_pos_of_sql_vocab)  # due to inital [CLS] token in BERT-input vector

                # and token
                if i_wn < wn - 1:
                    pnt_idx1 = get_pnt_idx1(col_pool_type, i_sql_vocab1[8])
                    g_pnt_idxs1.append(pnt_idx1)

        # end token
        pnt_idx1 = get_pnt_idx1(col_pool_type, i_sql_vocab1[-1])
        g_pnt_idxs1.append(pnt_idx1)

        g_pnt_idxs.append(g_pnt_idxs1)

    return g_pnt_idxs
def gen_g_pnt_idx ( g_wvi , sql_i , i_hds , i_sql_vocab , col_pool_type ) : g_pnt_idxs = [ ] for b , sql_i1 in enumerate ( sql_i ) : i_sql_vocab1 = i_sql_vocab [ b ] i_hds1 = i_hds [ b ] g_pnt_idxs1 = [ ] # start token pnt_idx1 = get_pnt_idx1 ( col_pool_type , i_sql_vocab1 [ - 2 ] ) g_pnt_idxs1 . append ( pnt_idx1 ) # select token pnt_idx1 = get_pnt_idx1 ( col_pool_type , i_sql_vocab1 [ 6 ] ) g_pnt_idxs1 . append ( pnt_idx1 ) # select agg idx_agg = sql_i1 [ "agg" ] pnt_idx1 = get_pnt_idx1 ( col_pool_type , i_sql_vocab1 [ idx_agg ] ) g_pnt_idxs1 . append ( pnt_idx1 ) # select column idx_sc = sql_i1 [ "sel" ] pnt_idx1 = get_pnt_idx1 ( col_pool_type , i_hds1 [ idx_sc ] ) g_pnt_idxs1 . append ( pnt_idx1 ) conds = sql_i1 [ "conds" ] wn = len ( conds ) if wn <= 0 : pass else : # select where pnt_idx1 = get_pnt_idx1 ( col_pool_type , i_sql_vocab1 [ 7 ] ) g_pnt_idxs1 . append ( pnt_idx1 ) for i_wn , conds1 in enumerate ( conds ) : # where column idx_wc = conds1 [ 0 ] pnt_idx1 = get_pnt_idx1 ( col_pool_type , i_hds1 [ idx_wc ] ) g_pnt_idxs1 . append ( pnt_idx1 ) # where op idx_wo = conds1 [ 1 ] pnt_idx1 = get_pnt_idx1 ( col_pool_type , i_sql_vocab1 [ idx_wo + 9 ] ) g_pnt_idxs1 . append ( pnt_idx1 ) # where val st , ed = g_wvi [ b ] [ i_wn ] end_pos_of_sql_vocab = i_sql_vocab1 [ - 1 ] [ - 1 ] g_pnt_idxs1 . append ( st + 1 + end_pos_of_sql_vocab ) # due to inital [CLS] token in BERT-input vector g_pnt_idxs1 . append ( ed + 1 + end_pos_of_sql_vocab ) # due to inital [CLS] token in BERT-input vector # and token if i_wn < wn - 1 : pnt_idx1 = get_pnt_idx1 ( col_pool_type , i_sql_vocab1 [ 8 ] ) g_pnt_idxs1 . append ( pnt_idx1 ) # end token pnt_idx1 = get_pnt_idx1 ( col_pool_type , i_sql_vocab1 [ - 1 ] ) g_pnt_idxs1 . append ( pnt_idx1 ) g_pnt_idxs . append ( g_pnt_idxs1 ) return g_pnt_idxs