def summarize_topics(f='lsi_topics.json', num_topics=1000, num_tokens=10, column_width=10, do_print=True, justify=True, data_path=DATA_PATH):
    """Load json file containing topic key/value pairs and print the top m words for the top n features"""
    if isinstance(f, basestring):
        if os.path.sep not in f:
            f = os.path.expanduser(os.path.join(data_path, f))
        f = open(f, 'rUb')
    if isinstance(f, pd.DataFrame):
        f = list(np.array(f[f.columns[-1]]))
    elif isinstance(f, file):
        f = json.load(f)
    if isinstance(f, Mapping):
        f = [v for k, v in sorted(f.items())]
    topics = list(f)
    s = ''
    digits = num_digits(min(len(topics), num_topics) - 1)
    for i, t in enumerate(topics):
        if i > num_topics:
            break
        t_sorted = sorted(t.items(), key=lambda x: -abs(x[1]))[:num_tokens]
        line = '{:{}d}: {}'.format(i, digits, ' '.join(('-+'[int(v > 0)] + '{:{}s}'.format(k[:column_width], column_width) for (k, v) in t_sorted)))
        if not justify:
            line = ' '.join([col for col in line.split(' \t') if col])
        s += line + '\n'
    if do_print:
        print(s)
    return s.split('\n')[:-1]
Load json file containing topic key/value pairs and print the top m words for the top n features