def tokens_to_index(token_list, vocab_dict):
    """
    convert word tokens to number index

    INPUT:
        token_list: a list of string tokens
        vocab_dict: a dictionary with tokens(key)-integer(value) pairs
    OUTPUT:
        index_list: a list of integer indices
    """
    index_list = []
    for x in token_list:
        try:
            index_list.append(vocab_dict[x])
        except:
            index_list.append(1)  # index for oov tokens
    return index_list