(model, feature_names, n_top_words=40)
return topic_words
Return top forty words from each topic in trained topic model.
Return top forty words from each topic in trained topic model.
Return top forty words from each topic in trained topic model .
def _get_top_words(model, feature_names, n_top_words=40):
    """ Return top forty words from each topic in trained topic model.
    """
    topic_words = []
    for topic in model.components_:
        top_words = [feature_names[i] for i in topic.argsort()[:-n_top_words-1:-1]]
        topic_words += [top_words]
    return topic_words
def _get_top_words ( model , feature_names , n_top_words = 40 ) : topic_words = [ ] for topic in model . components_ : top_words = [ feature_names [ i ] for i in topic . argsort ( ) [ : - n_top_words - 1 : - 1 ] ] topic_words += [ top_words ] return topic_words