Skip to content

Commit c1a1175

Browse files
ability to pass entities list to verify
1 parent 9e480d4 commit c1a1175

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

webstruct/annotation_verifier.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import webstruct.loaders
66
import webstruct.webannotator
77

8-
KNOWN_ENTITIES = [
8+
DEFAULT_ENTITIES = [
99
'ORG', 'TEL', 'FAX', 'HOURS',
1010
'STREET', 'CITY', 'STATE', 'ZIPCODE', 'COUNTRY',
1111
'EMAIL', 'PER', 'FUNC', 'SUBJ'
@@ -109,6 +109,11 @@ def main():
109109
help='path to file annotated in WebAnnotator format',
110110
type=str,
111111
required=True)
112+
cmdline.add_argument('--entity',
113+
help='enitity type to verify against',
114+
type=str,
115+
action='append',
116+
required=False)
112117
cmdline.add_argument('--loglevel',
113118
help='logging level',
114119
type=str,
@@ -119,7 +124,12 @@ def main():
119124
format=('%(asctime)s [%(levelname)s] '
120125
'%(pathname)s:%(lineno)d %(message)s'))
121126

122-
entities = KNOWN_ENTITIES
127+
if args.entity:
128+
entities = args.entity
129+
else:
130+
entities = DEFAULT_ENTITIES
131+
132+
logging.debug('Known entities %s', entities)
123133

124134
gate = webstruct.loaders.GateLoader(known_entities=entities)
125135
wa = webstruct.loaders.WebAnnotatorLoader(known_entities=entities)

0 commit comments

Comments
 (0)