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
4d8fb041
Commit
4d8fb041
authored
3 years ago
by
vvye
Browse files
Options
Downloads
Patches
Plain Diff
Implement console arguments
parent
66c32055
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
run.py
+35
-5
35 additions, 5 deletions
run.py
with
35 additions
and
5 deletions
run.py
+
35
−
5
View file @
4d8fb041
import
argparse
import
dataset
import
evaluation
import
timeline_generation
...
...
@@ -15,7 +17,10 @@ keywords_by_topic = {
}
def
main
():
def
main
(
args
):
eval_results
=
[]
data
=
dataset
.
get_timeline17_dataset
(
'
data/in/timeline17/Data
'
)
for
topic
in
data
.
keys
():
...
...
@@ -23,16 +28,41 @@ def main():
gold_timelines
=
data
[
topic
][
'
gold_timelines
'
]
keywords
=
keywords_by_topic
[
topic
]
eval_results
[
topic
]
=
{
gold_timeline_name
:
{}
for
gold_timeline_name
in
gold_timelines
.
keys
()}
for
gold_timeline_name
,
gold_timeline
in
gold_timelines
.
items
():
print
(
f
'
Topic
{
topic
}
, gold timeline
{
gold_timeline_name
}
'
)
timeline
=
timeline_generation
.
make_timeline
(
articles
,
gold_timeline
,
keywords
)
timeline_generation
.
print_timeline
(
timeline
)
ar1_f
,
ar2_f
=
evaluation
.
evaluate
(
timeline
,
[
gold_timeline
])
date_f1
=
evaluation
.
date_f1
(
timeline
,
gold_timeline
)
print
(
f
'
{
ar1_f
}
,
{
ar2_f
}
,
{
date_f1
}
'
)
if
args
.
timeline_output_path
:
print
(
'
output to file
'
)
# todo
if
args
.
evaluate
:
ar1_f
,
ar2_f
=
evaluation
.
evaluate
(
timeline
,
[
gold_timeline
])
date_f1
=
evaluation
.
date_f1
(
timeline
,
gold_timeline
)
eval_results
.
append
({
topic
,
gold_timeline_name
,
ar1_f
,
ar2_f
,
date_f1
})
break
break
if
args
.
evaluation_output_file
:
print
(
'
output to file
'
)
# todo
if
__name__
==
'
__main__
'
:
main
()
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'
--timeline_output_path
'
,
type
=
str
,
help
=
'
a directory to save the generated timeline files
'
'
(if this argument is not present, timelines will only be printed to the console)
'
)
parser
.
add_argument
(
'
--evaluate
'
,
action
=
'
store_true
'
,
help
=
'
whether to evaluate the timelines after generating them
'
)
parser
.
add_argument
(
'
--evaluation_output_file
'
,
type
=
str
,
help
=
'
a file to save the evaluation output (only applies if the argument --evaluate is given)
'
)
main
(
parser
.
parse_args
())
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