def main():
    # get weekly counts for each author and plot one
    df = read_forum_json('json/levergunscommunity.com.json')
    author_date_df = to_daily_active_counts(df)
    author_week_df = aggregate_weekly(author_date_df)
    plot_author(author_week_df, '1002')

    # Get weekly contents produced for each author and do lda for that week
    author_date_content = to_daily_agg_contents(df)
    author_week_content = aggregate_weekly(author_date_content)
    lda, corpus, dictionary = lda_weekly(author_week_content.iloc[:, 50])
    # infer topic for the first document which corresponds to the first row
    print lda[corpus[0]]

    # Get keywords for each author in each week by doing LDA
    author_week_keywords = author_week_content.apply(weekly_keywords, axis=0)
Beispiel #2
0
def main():
    df = read_forum_json('json/levergunscommunity.com.json')
    corpus, dictionary = generate_corpus(df)
    lda = LdaMulticore(corpus, num_topics=20, id2word=dictionary, workers=3)
    lda.print_topics(num_topics=20, num_words=20)