def get_posts(article): posts = article.comment_set if posts.count() == 0: if article.source.source_name == "The Atlantic": get_disqus_posts(article, None, None) elif article.source.source_name == "Reddit": get_reddit_posts(article, None, None) count_replies(article) posts = article.comment_set.filter( reply_to_disqus=None).order_by('-points') else: posts = posts.filter(reply_to_disqus=None).order_by('-points') if article.vectorizer == None: create_vectors(article) posts = article.comment_set.filter(reply_to_disqus=None) from website.views import recurse_viz recurse_viz(None, posts, False, article, False) return posts[0:10]
def count_article(art): posts = Comment.objects.filter(article=art, reply_to_disqus=None, hidden=False) val2 = {} from website.views import recurse_viz val2['children'], val2['hid'], val2[ 'replace'], num_subchildren = recurse_viz(None, posts, False, art, False) num_words_all = count_all_words(0, val2) num_words_still = count_unsummarized_words(0, val2) # if num_words_all >= 250: # num_words_all = num_words_all - 250; # num_words_still = num_words_still - 250; # else: # half = old_div(num_words_all,2); # num_words_all = num_words_all - half; # num_words_still = num_words_still - half; if num_words_all != 0: value = round( ((1.0 - float(float(num_words_still) / float(num_words_all))) * 100.0)) else: value = 0 if value > 100: value = 100 return value
def count_words_shown(art): posts = Comment.objects.filter(article=art, reply_to_disqus=None, hidden=False) val2 = {} from website.views import recurse_viz val2['children'], val2['hid'], val2[ 'replace'], num_subchildren = recurse_viz(None, posts, False, art, False) count = count_unsummarized_words(0, val2) + count_summary_words(0, val2) return count
def get_posts(article): posts = article.comment_set if posts.count() == 0: if article.source.source_name == "The Atlantic": get_disqus_posts(article, None, None) elif article.source.source_name == "Reddit": get_reddit_posts(article, None, None) count_replies(article) posts = article.comment_set.filter(reply_to_disqus=None).order_by('-points') else: posts = posts.filter(reply_to_disqus=None).order_by('-points') if article.vectorizer == None: create_vectors(article) posts = article.comment_set.filter(reply_to_disqus=None) from website.views import recurse_viz recurse_viz(None, posts, False, article, False) return posts[0:10]