Exemple #1
0
def project(slug, trial='trial1'):
    cfg = get_project_config(slug)
    els = Elements(cfg, trial)
    set_project_menu(cfg, slug, trial)
    data['slug'] = slug
    data['trial'] = trial
    data['pub_home'] = os.environ['POLO_PUB']
    data['page_title'] = '{}, {}'.format(slug, trial)
    data['ini'] = cfg.ini['DEFAULT']  # Really?
    data['trials'] = cfg.get_trial_names()
    data['groups'] = cfg.get_group_fields()
    data['src_ord_col'] = cfg.ini['DEFAULT']['src_ord_col']
    data['doc_count'] = els.get_doc_count()
    data['topic_count'] = els.get_topic_count()
    data['topics'] = els.get_topics()
    data['bigrams'] = els.get_top_bigrams()
    data['phrases'] = els.get_all_topic_phrases()
    #data['ngm'] = els.get_ngram_group_matrix(degree=2)
    src_ord_col = cfg.ini['DEFAULT']['src_ord_col']
    print(src_ord_col)
    data['dtm'] = els.get_topicdoc_group_matrix(group_field=src_ord_col)
    data['doc_ord_counts'] = els.get_topicdocgrooup_counts(
        'topic{}_matrix_counts'.format(src_ord_col))
    data['dtm_sums'] = els.get_topicdoc_sum_matrix(data['dtm'],
                                                   data['doc_ord_counts'])
    return render_template("project.html", **data)
def topicdoc_heatmap(slug, trial='trial1', group_field='label'):
    cfg = get_project_config(slug)
    els = Elements(cfg, trial)
    set_project_menu(cfg, slug, trial)
    data['ini'] = cfg.ini['DEFAULT']
    data['trials'] = cfg.get_trial_names()
    data['slug'] = slug
    data['trial'] = trial
    data['page_title'] = '{}, {}: Topic-{} Heatmap'.format(
        slug, trial, group_field)
    data['dtm'] = els.get_topicdoc_group_matrix(group_field=group_field,
                                                use_glass_label=True)
    return render_template("topic_label_heatmap.html", **data)