-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:AYLIEN/news-signals-datasets into main
- Loading branch information
Showing
5 changed files
with
8,454 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import argparse | ||
from pathlib import Path | ||
|
||
import arrow | ||
|
||
from news_signals.signals_dataset import generate_dataset | ||
|
||
|
||
def main(args): | ||
generate_dataset( | ||
input=Path(args.input_csv), | ||
output_dataset_dir=Path(args.output_dataset_dir), | ||
start=arrow.get(args.start).datetime, | ||
end=arrow.get(args.end).datetime, | ||
id_field=args.id_field, | ||
name_field=args.name_field, | ||
overwrite=args.overwrite, | ||
delete_tmp_files=True, | ||
) | ||
|
||
|
||
def parse_args(): | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument( | ||
'--start', | ||
required=True, | ||
help="start date, e.g. 2020-1-1" | ||
) | ||
parser.add_argument( | ||
'--end', | ||
required=True, | ||
help="end date, e.g. 2020-1-1" | ||
) | ||
parser.add_argument( | ||
'--input-csv', | ||
required=True, | ||
help="csv file with entities" | ||
) | ||
parser.add_argument( | ||
'--id-field', | ||
default="Wikidata ID", | ||
help="column in csv which indicates Wikidata id" | ||
) | ||
parser.add_argument( | ||
'--name-field', | ||
default="Wikidata Label", | ||
help="column in csv which indicates Wikidata id" | ||
) | ||
parser.add_argument( | ||
'--output-dataset-dir', | ||
required=True, | ||
help="dir where dataset is stored" | ||
) | ||
parser.add_argument( | ||
'--overwrite', | ||
action="store_true", | ||
) | ||
return parser.parse_args() | ||
|
||
|
||
if __name__ == '__main__': | ||
main(parse_args()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.