forked from sbaltes/dblp-retriever
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dblp-retriever.py
64 lines (55 loc) · 1.64 KB
/
dblp-retriever.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import argparse
import logging
from dblp.venue_list import VenueList
logger = logging.getLogger('dblp-retriever_logger')
def get_argument_parser():
arg_parser = argparse.ArgumentParser(
description='Retrieve paper metadata from DBLP,'
)
arg_parser.add_argument(
'-i', '--input-file',
required=True,
help='CSV file with venue identifiers.',
dest='input_file'
)
arg_parser.add_argument(
'-o', '--output-dir',
required=True,
help='Path to output directory',
dest='output_dir'
)
arg_parser.add_argument(
'-d', '--delimiter',
required=False,
default=',',
help='delimiter for CSV files (default: \',\')',
dest='delimiter'
)
arg_parser.add_argument(
'-v', '--valdidating-page-ranges',
required=False,
default=False,
help='Enable page range validation with True (default: False)',
dest='page_validation'
)
arg_parser.add_argument(
'-p', '--pages',
required=False,
default=False,
help="Save paper's page ranges and length with True (default: False)",
dest='pages'
)
return arg_parser
def main():
# parse command line arguments
parser = get_argument_parser()
args = parser.parse_args()
# process venues
venue_list = VenueList()
venue_list.read_from_csv(args.input_file, args.delimiter)
venue_list.retrieve_papers(with_pages=args.pages)
if args.page_validation:
venue_list.validate_page_ranges()
venue_list.write_to_csv(args.output_dir, args.delimiter)
if __name__ == '__main__':
main()