def get_field_index(multi_hot_flags):
    """infer field index of each column using `multi_hot_flags`
    Example:
    get_field_index([False,False,True,True,True,False])  # [0,1,2,2,2,3]
    """
    field_indices = []
    cur_field_index = 0
    for i, flag in enumerate(multi_hot_flags):
        field_indices.append(cur_field_index)
        if not flag or (
                flag and (i+1 < len(multi_hot_flags))
                and not multi_hot_flags[i+1]):
            cur_field_index += 1
    return field_indices