Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit 10b9aef

Browse files
author
Peter Izsak
committed
Fixed conlleval.py
1 parent c1b287e commit 10b9aef

File tree

1 file changed

+1
-30
lines changed

1 file changed

+1
-30
lines changed

nlp_architect/utils/conlleval.py

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# ******************************************************************************
2-
# this file is taken from https://github.com/spyysalo/conlleval.py
2+
# modified from original code at https://github.com/spyysalo/conlleval.py
33
# ------------------------------------------------------------------------------
44
# The MIT License (MIT)
55
#
@@ -59,22 +59,6 @@ def __init__(self):
5959
self.t_found_correct = defaultdict(int)
6060
self.t_found_guessed = defaultdict(int)
6161

62-
def parse_args(argv):
63-
import argparse
64-
parser = argparse.ArgumentParser(
65-
description='evaluate tagging results using CoNLL criteria',
66-
formatter_class=argparse.ArgumentDefaultsHelpFormatter
67-
)
68-
arg = parser.add_argument
69-
arg('-b', '--boundary', metavar='STR', default='-X-',
70-
help='sentence boundary')
71-
arg('-d', '--delimiter', metavar='CHAR', default=ANY_SPACE,
72-
help='character delimiting items in input')
73-
arg('-o', '--otag', metavar='CHAR', default='O',
74-
help='alternative outside tag')
75-
arg('file', nargs='?', default=None)
76-
return parser.parse_args(argv)
77-
7862
def parse_tag(t):
7963
m = re.match(r'^([^-]*)-(.*)$', t)
8064
return m.groups() if m else (t, '')
@@ -255,16 +239,3 @@ def start_of_chunk(prev_tag, tag, prev_type, type_):
255239
if tag == ']': chunk_start = True
256240

257241
return chunk_start
258-
259-
def main(argv):
260-
args = parse_args(argv[1:])
261-
262-
if args.file is None:
263-
counts = evaluate(sys.stdin, args)
264-
else:
265-
with open(args.file) as f:
266-
counts = evaluate(f, args)
267-
report(counts)
268-
269-
if __name__ == '__main__':
270-
sys.exit(main(sys.argv))

0 commit comments

Comments
 (0)