Skip to content

Commit

Permalink
foliacat now correctly uses the version of the newest input document
Browse files Browse the repository at this point in the history
  • Loading branch information
proycon committed Mar 19, 2019
1 parent 7370053 commit ab46096
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion foliatools/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = "2.0.1"
VERSION = "2.0.2"
7 changes: 6 additions & 1 deletion foliatools/foliacat.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,15 @@ def concat(target, source):
def foliacat(id, outputfile, *files):
totalmerges = 0
outputdoc = folia.Document(id=id,keepversion=True)
outputdoc.version = "0.0.0"
text = outputdoc.append(folia.Text(outputdoc,id=id + ".text"))
for i, filename in enumerate(files):
merges = 0
print("Processing " + filename, file=sys.stderr)
inputdoc = folia.Document(file=filename)
inputdoc = folia.Document(file=filename,keepversion=True)
#we take the version of the newest document
if folia.checkversion(inputdoc.version, outputdoc.version) > 0:
outputdoc.version = inputdoc.version
print("(merging document)",file=sys.stderr)

for annotationtype,set in inputdoc.annotations:
Expand All @@ -53,6 +57,7 @@ def foliacat(id, outputfile, *files):
print("(merged " + str(merges) + " elements, with all elements contained therein)",file=sys.stderr)
totalmerges += merges


print("(TOTAL: merged " + str(totalmerges) + " elements, with all elements contained therein)",file=sys.stderr)
if outputfile and merges > 0:
outputdoc.save(outputfile)
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.0.1", #also change in __init__.py
version = "2.0.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 ab46096

Please sign in to comment.