(train_data, wv, idx_w2i, n_total, w2i, wemb)
return idx_w2i, n_total
Generate subset of GloVe
        update_w2i_wemb. It uses wv, w2i, wemb, idx_w2i as global variables.

        To do
        1. What should we do with the numeric?
Generate subset of GloVe
        update_w2i_wemb. It uses wv, w2i, wemb, idx_w2i as global variables.
Generate subset of GloVe update_w2i_wemb . It uses wv w2i wemb idx_w2i as global variables .
def generate_w2i_wemb(train_data, wv, idx_w2i, n_total, w2i, wemb):
    """ Generate subset of GloVe
        update_w2i_wemb. It uses wv, w2i, wemb, idx_w2i as global variables.

        To do
        1. What should we do with the numeric?
    """
    # word_set from NL query
    for i, t1 in enumerate(train_data):
        # NLq = t1['question']
        # word_tokens = NLq.rstrip().replace('?', '').split(' ')
        word_tokens = t1['question_tok']
        # Currently, TAPI does not use "?". So, it is removed.
        for word in word_tokens:
            idx_w2i, n_total = update_w2i_wemb(word, wv, idx_w2i, n_total, w2i, wemb)
            n_total += 1

    return idx_w2i, n_total
def generate_w2i_wemb ( train_data , wv , idx_w2i , n_total , w2i , wemb ) : # word_set from NL query for i , t1 in enumerate ( train_data ) : # NLq = t1['question'] # word_tokens = NLq.rstrip().replace('?', '').split(' ') word_tokens = t1 [ 'question_tok' ] # Currently, TAPI does not use "?". So, it is removed. for word in word_tokens : idx_w2i , n_total = update_w2i_wemb ( word , wv , idx_w2i , n_total , w2i , wemb ) n_total += 1 return idx_w2i , n_total