Skip to content
Snippets Groups Projects
Commit a5d0ee9d authored by vvye's avatar vvye
Browse files

Move one line of code

parent e1cc453c
No related branches found
No related tags found
No related merge requests found
......@@ -15,8 +15,6 @@ def rank_dates_by_mention_count(articles, start_date, end_date):
def rank_dates_by_wilson(articles, start_date, end_date):
edges = []
# count how often each published -> mentioned pair occurs
pub_to_mention_count = Counter({})
for article in articles:
......@@ -28,6 +26,7 @@ def rank_dates_by_wilson(articles, start_date, end_date):
# the edge weight for each published -> mentioned pair
# is how often it occurs * the temporal distance between the dates
edges = []
for pub_date, mentioned_date in pub_to_mention_count.keys():
date_diff = (datetime.strptime(pub_date, '%Y-%m-%d') - datetime.strptime(mentioned_date, '%Y-%m-%d')).days
edge_weight = pub_to_mention_count[(pub_date, mentioned_date)] * abs(date_diff)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment