def top_words_tab(topic, topic_url, images_url): tab = Tab("Top Words", path='topics/top_words') word_url = '%s/words/' % topic_url topicwords = topic.topicword_set.filter( word__ngram=False).order_by('-count') words = [] for topicword in topicwords[:100]: percent = float(topicword.count) / topic.total_count w = WordSummary(topicword.word.type, percent) w.url = word_url + topicword.word.type words.append(w) tab.add(word_chart_widget(words)) # tab.add(Widget('Word Cloud',content_html=unigram_cloud(words))) tab.add(word_cloud_widget(words, title='Word Cloud')) ttcloud = turbo_topics_cloud_widget(topic) if ttcloud: tab.add(ttcloud) ngcloud = ngram_cloud_widget(topic, word_url) if ngcloud: tab.add(ngcloud) tab.add(words_in_context_widget(images_url, words)) return tab
def attribute_info_tab(analysis, attribute, value, analysis_url, attributes_url): tab = Tab('Attribute Information', 'attributes/attribute_info') token_count = attribute.attributevalue_set.get(value=value).token_count words = get_words(attribute, value, attributes_url, token_count) tab.add(metrics_widget(attribute, value, token_count)) tab.add(top_words_chart_widget(words)) tab.add(word_cloud_widget(words)) ngram_widget = ngram_word_cloud_widget(attribute, value, attributes_url, token_count) if ngram_widget: tab.add(ngram_widget) tab.add(topic_cloud_widget(analysis, attribute, value, analysis_url, token_count)) return tab
def extra_information_tab(request, topic, topic_url): tab = Tab("Extra Information", 'topics/extra_information') tab.add(metrics_widget(topic)) tab.add(metadata_widget(topic)) tab.add(top_documents_widget(topic, topic_url)) tab.add(top_values_widget(request, topic)) return tab
def words_tab(analysis, word, word_url, images_url): tab = Tab('Word Information', 'words/word_information') tab.add(top_documents_widget(analysis.dataset, word)) tab.add(top_topics_widget(analysis, word)) tab.add(total_count_widget(word)) tab.add(word_in_context_widget(word, word_url, images_url)) return tab
def similar_topics_tab(request, topic, name_scheme_name): tab = Tab("Similar Topics", 'topics/similar_topics') tab.add(similar_topic_list_widget(request, topic)) tab.add(topic_map_widget(topic, name_scheme_name)) return tab
def text_tab(document): tab = Tab('Text', 'documents/text') tab.add(plain_text_widget(document)) return tab
def similar_documents_tab(request, analysis, document): tab = Tab("Similar Documents", 'documents/similar_documents') tab.add(similar_documents_widget(request, analysis, document)) return tab
def extra_information_tab(analysis, document): tab = Tab("Extra Information", 'documents/extra_information') tab.add(metrics_widget(document)) tab.add(metadata_widget(document)) tab.add(top_topics_widget(analysis, document)) return tab