Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
BA Timeline Summarization
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
kaiser
BA Timeline Summarization
Commits
a5d0ee9d
Commit
a5d0ee9d
authored
3 years ago
by
vvye
Browse files
Options
Downloads
Patches
Plain Diff
Move one line of code
parent
e1cc453c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
date_selection.py
+1
-2
1 addition, 2 deletions
date_selection.py
with
1 addition
and
2 deletions
date_selection.py
+
1
−
2
View file @
a5d0ee9d
...
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment