Skip to content

Commit

Permalink
Added --fixinvalidreferences parameter to foliavalidator (proycon/fla…
Browse files Browse the repository at this point in the history
  • Loading branch information
proycon committed Jul 1, 2021
1 parent c86bd42 commit 3ee2961
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion foliatools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""FoLiA-tools contains various Python-based command line tools for working with FoLiA XML (Format for Linguistic Annotation)"""

VERSION = "2.5.1"
VERSION = "2.5.2"
6 changes: 3 additions & 3 deletions foliatools/foliavalidator.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def validate(filename, schema = None,**kwargs):
print(str(e), file=sys.stderr)
return False
try:
document = folia.Document(file=filename, deepvalidation=kwargs.get('deep',False),textvalidation=kwargs.get('stricttextvalidation',False),verbose=True, autodeclare=kwargs.get('autodeclare',False), processor=kwargs.get('processor'), keepversion=kwargs.get('keepversion'), fixunassignedprocessor=kwargs.get('fixunassignedprocessor'), debug=kwargs.get('debug',0))
document = folia.Document(file=filename, deepvalidation=kwargs.get('deep',False),textvalidation=kwargs.get('stricttextvalidation',False),verbose=True, autodeclare=kwargs.get('autodeclare',False), processor=kwargs.get('processor'), keepversion=kwargs.get('keepversion'), fixunassignedprocessor=kwargs.get('fixunassignedprocessor'), fixinvalidreferences=kwargs.get('fixinvalidreferences',False), checkreferences=not kwargs.get('fixinvalidreferences',False), debug=kwargs.get('debug',0))
except folia.DeepValidationError as e:
print("DEEP VALIDATION ERROR on full parse by library (stage 2/3), in " + filename,file=sys.stderr)
print(e.__class__.__name__ + ": " + str(e),file=sys.stderr)
Expand Down Expand Up @@ -106,8 +106,9 @@ def commandparser(parser):
parser.add_argument('-k','--keepversion',help="Attempt to keep an older FoLiA version (not always guaranteed to work)", action='store_true', default=False)
parser.add_argument('-D','--debug',type=int,help="Debug level", action='store',default=0)
parser.add_argument('-b','--traceback',help="Provide a full traceback on validation errors", action='store_true', default=False)
parser.add_argument('-x','--explicit',help="Serialise to explicit form, this generates more verbose XML and simplified the job for parsers as implicit information is made explicit", action='store_true', default=False)
parser.add_argument('-x','--explicit',help="Serialise to explicit form, this generates more verbose XML and simplifies the job for parsers as implicit information is made explicit", action='store_true', default=False)
parser.add_argument('--fixunassignedprocessor',help="Fixes invalid FoLiA that does not explicitly assign a processor to an annotation when multiple processors are possible (and there is therefore no default). The first processor will be used in this case.", action='store_true', default=False)
parser.add_argument('--fixinvalidreferences',help="Fixes invalid FoLiA that contains invalid references. Fixing here simply means all invalid references will be removed (and replaced by an XML comment)", action='store_true', default=False)
return parser

def main():
Expand All @@ -124,7 +125,6 @@ def main():

if args.files:
success = True
skipnext = False
for file in args.files:
r = False
if os.path.isdir(file):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def read(fname):

setup(
name = "FoLiA-tools",
version = "2.5.1", #also change in __init__.py
version = "2.5.2", #also change in __init__.py
author = "Maarten van Gompel",
author_email = "proycon@anaproy.nl",
description = ("FoLiA-tools contains various Python-based command line tools for working with FoLiA XML (Format for Linguistic Annotation)"),
Expand Down

0 comments on commit 3ee2961

Please sign in to comment.