def extract_topn_from_vector(feature_names, sorted_items, topn=10):
    """get the feature names and tf-idf score of top n items"""
    score_vals = []
    feature_vals = []
    to_remove = set()
    for idx, score in sorted_items:
        skip = False
        for i, keywords in enumerate(feature_vals):
            for already in keywords.split():
                for toAdd in feature_names[idx].split():
                    if toAdd in already:
                        skip = True
                        if len(feature_vals[i]) < len(feature_names[idx]):
                            feature_vals[i] = feature_names[idx]
        if not skip and feature_names[idx] not in feature_vals:
            score_vals.append(round(score, 6))
            feature_vals.append(feature_names[idx])
            for i in range(len(feature_vals)):
                for j in range(i + 1, len(feature_vals)):
                    if feature_vals[i] == feature_vals[j]:
                        score_vals[i] += score_vals[j]
                        to_remove.add(j)
            if len(score_vals) - len(to_remove) == topn:
                break
    for j in sorted(to_remove, reverse=True):
        del feature_vals[j]
        del score_vals[j]
    results = zip(feature_vals, score_vals)
    return list(results)
