-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathcitron_evaluate.py
More file actions
executable file
·52 lines (43 loc) · 1.23 KB
/
citron_evaluate.py
File metadata and controls
executable file
·52 lines (43 loc) · 1.23 KB
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
# Copyright 2021 BBC
# Authors: Chris Newell <chris.newell@bbc.co.uk>
#
# License: Apache-2.0
"""
This application evaluates the Citron quote extraction system.
"""
import argparse
import logging
from citron.citron import Citron
from citron import utils
from citron.logger import logger
def main():
parser = argparse.ArgumentParser(
description='Evaluate Citron',
formatter_class=argparse.ArgumentDefaultsHelpFormatter
)
parser.add_argument('-v',
action = 'store_true',
default = False,
help = 'Verbose mode'
)
parser.add_argument('--model-path',
metavar = 'model_path',
type = str,
required=True,
help = 'Path to the Citron model directory'
)
parser.add_argument("--test-path",
metavar = "test_path",
type = str,
required=True,
help = "Path to file or directory containing Citron annotation format test data (default: no testing)"
)
args = parser.parse_args()
if args.v:
logger.setLevel(logging.DEBUG)
logger.info("Evaluating Citron using: %s", args.test_path)
nlp = utils.get_parser()
citron = Citron(args.model_path, nlp)
citron.evaluate(args.test_path)
if __name__ == '__main__':
main()