def segregate_features(feature_list):
    """ This function segregates features corresponding to the same query given a list of extracted features from a document.
    The list returned is a list of lists containing features corresponding to the same query
    """
    processed=[]       # This list holds the query indices which have been segregated from the feature_list argument
    segregated_feat=[]    # List to be returned
    count=0            # Count of features segregated

    for feature in feature_list:
        if feature.queryindex not in processed:
            cur_idx=feature.queryindex
            cur_query_list=[]
            for feature in feature_list:
                if feature.queryindex==cur_idx:
                    cur_query_list.append(feature)
            segregated_feat.append(cur_query_list)
            processed.append(cur_idx)
    return segregated_feat