Skip to content

Commit

Permalink
better version reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
proycon committed Mar 22, 2019
1 parent ab46096 commit 6873add
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 63 deletions.
2 changes: 1 addition & 1 deletion folia
Submodule folia updated 83 files
+0 −1 .travis.yml
+ docs/folia.pdf
+3 −3 docs/folia.tex
+5 −3 docs/source/alternative_annotation.rst
+2 −6 docs/source/annotation_declarations.rst
+17 −8 docs/source/annotation_types.rst
+1 −1 docs/source/chunking_annotation.rst
+1 −1 docs/source/comment_annotation.rst
+19 −7 docs/source/conf.py
+2 −1 docs/source/content_annotation_category.rst
+1 −1 docs/source/coreference_annotation.rst
+1 −1 docs/source/correction_annotation.rst
+2 −40 docs/source/definition_annotation.rst
+1 −1 docs/source/dependency_annotation.rst
+1 −1 docs/source/description_annotation.rst
+1 −0 docs/source/division_annotation.rst
+8 −2 docs/source/entity_annotation.rst
+228 −7 docs/source/entry_annotation.rst
+2 −1 docs/source/event_annotation.rst
+2 −41 docs/source/example_annotation.rst
+0 −6 docs/source/external.rst
+3 −2 docs/source/features.rst
+4 −2 docs/source/figure_annotation.rst
+35 −0 docs/source/foreign_annotation.rst
+18 −18 docs/source/fql.rst
+1 −1 docs/source/gap_annotation.rst
+46 −0 docs/source/guidelines.rst
+2 −1 docs/source/head_annotation.rst
+57 −0 docs/source/hiddentoken_annotation.rst
+2 −1 docs/source/higherorder_annotation_category.rst
+38 −2 docs/source/hyperlinks.rst
+57 −0 docs/source/hyphenation_annotation.rst
+41 −0 docs/source/implementations.rst
+13 −22 docs/source/index.rst
+2 −1 docs/source/inline_annotation_category.rst
+39 −13 docs/source/introduction.rst
+45 −0 docs/source/libraries.csv
+3 −2 docs/source/linebreak_annotation.rst
+3 −1 docs/source/list_annotation.rst
+17 −3 docs/source/metadata.rst
+1 −1 docs/source/metric_annotation.rst
+2 −1 docs/source/note_annotation.rst
+1 −1 docs/source/observation_annotation.rst
+3 −2 docs/source/paragraph_annotation.rst
+24 −7 docs/source/part_annotation.rst
+2 −2 docs/source/phon_annotation.rst
+3 −2 docs/source/provenance_data.rst
+2 −1 docs/source/quote_annotation.rst
+8 −5 docs/source/reference_annotation.rst
+4 −4 docs/source/relation_annotation.rst
+1 −1 docs/source/semrole_annotation.rst
+3 −2 docs/source/sentence_annotation.rst
+1 −1 docs/source/sentiment_annotation.rst
+4 −5 docs/source/set_definitions.rst
+12 −1 docs/source/span_annotation_category.rst
+2 −2 docs/source/speech.rst
+3 −3 docs/source/string_annotation.rst
+6 −1 docs/source/structure_annotation_category.rst
+2 −1 docs/source/subtoken_annotation_category.rst
+2 −2 docs/source/syntax_annotation.rst
+5 −1 docs/source/table_annotation.rst
+2 −41 docs/source/term_annotation.rst
+2 −2 docs/source/text_annotation.rst
+2 −1 docs/source/textmarkup_annotation_category.rst
+1 −2 docs/source/token_annotation.rst
+2 −1 docs/source/utterance_annotation.rst
+3 −2 docs/source/whitespace_annotation.rst
+4 −0 examples/README.md
+96 −0 examples/erroneous/invalid-wref.2.0.0.folia.xml
+91 −0 examples/group-annotations.2.0.0.folia.xml
+1 −1 examples/provenance.2.0.0.folia.xml
+13 −13 examples/quotes.2.0.0.folia.xml
+96 −0 examples/syntactic-movement.2.0.0.folia.xml
+40 −0 examples/tests/provenance-flat-explicit.2.0.0.folia.xml
+32 −0 examples/tests/provenance-flat-implicit.2.0.0.folia.xml
+36 −0 examples/tests/provenance-nested-implicit.2.0.0.folia.xml
+6 −0 examples/whitespace-linebreaks.2.0.0.folia.xml
+110 −0 foliatools/conllu2folia.py
+1,573 −112 schemas/folia.rng
+60 −27 schemas/folia.yml
+132 −18 setdefinitions/namedentities.foliaset.ttl
+5 −1 setdefinitions/namedentities.foliaset.xml
+82 −0 setdefinitions/universal-pos.foliaset.ttl
2 changes: 1 addition & 1 deletion foliatools/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = "2.0.2"
VERSION = "2.0.3"
68 changes: 13 additions & 55 deletions foliatools/foliacat.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,11 @@

from __future__ import print_function, unicode_literals, division, absolute_import

import getopt
import argparse
import sys
from foliatools import VERSION as TOOLVERSION
import folia.main as folia

def usage():
print("foliacat",file=sys.stderr)
print(" by Maarten van Gompel (proycon)",file=sys.stderr)
print(" Radboud University Nijmegen",file=sys.stderr)
print(" 2014 - Licensed under GPLv3",file=sys.stderr)
print("",file=sys.stderr)
print("Concatenates multiple FoLiA documents into one; provided that all IDs are unique.",file=sys.stderr)
print("",file=sys.stderr)
print("Usage: foliacat [options] file1 file2 file3 ... ",file=sys.stderr)
print("",file=sys.stderr)
print("Options:",file=sys.stderr)
print(" -o [file] Output file",file=sys.stderr)
print(" -i [id] ID for output file (mandatory)",file=sys.stderr)


def concat(target, source):
merges = 0
Expand Down Expand Up @@ -65,49 +52,20 @@ def foliacat(id, outputfile, *files):
return outputdoc

def main():
try:
opts, args = getopt.getopt(sys.argv[1:], "o:i:h", ["help"])
except getopt.GetoptError as err:
print(str(err),file=sys.stderr)
usage()
sys.exit(2)

outputfile = None
substitute = False

id = None
for o, a in opts:
if o == '-h' or o == '--help':
usage()
sys.exit(0)
elif o == '-o':
outputfile = a
elif o == '-i':
id = a
else:
raise Exception("No such option: " + o)

if len(args) < 2:
parser = argparse.ArgumentParser(description="Concatenates two or more FoLiA documents", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('-v','--version',help="Show version information", action='version', version="FoLiA-tools v" + TOOLVERSION + ", using FoLiA v" + folia.FOLIAVERSION + " with library FoLiApy v" + folia.LIBVERSION, default=False)
parser.add_argument('-i','--id',type=str, help="Set the ID for the output document", action='store', required=True)
parser.add_argument('-o','--output',type=str, help="Output file (defaults to stdout if not set)", required=True)
parser.add_argument('files', nargs='*', help='Files to concatenate')
args = parser.parse_args()

if len(args.files) < 2:
print("WARNING: only one file specified", file=sys.stderr)
if not id:
print("ERROR: Please specify an ID for the result document with the -i option",file=sys.stderr)
sys.exit(2)


if substitute:
outputfile = args[0]

outputdoc = foliacat(id, outputfile, *args)
if not outputfile:
xml = outputdoc.xmlstring()
if sys.version < '3':
if isinstance(xml,unicode):
print(xml.encode('utf-8'))
else:
print(xml)
else:
print(xml)

outputdoc = foliacat(id, args.outputfile, *args.files)
if not args.outputfile:
print(outputdoc.xmlstring())

if __name__ == "__main__":
main()
Expand Down
7 changes: 2 additions & 5 deletions foliatools/foliavalidator.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import traceback
import lxml.etree
import argparse
from foliatools import VERSION as TOOLVERSION
import folia.main as folia


Expand Down Expand Up @@ -87,15 +88,11 @@ def commandparser(parser):

def main():
parser = argparse.ArgumentParser(description="Checks whether a FoLiA document is a valid FoLiA document, i.e. whether is properly adheres to the specification. Invalid documents should never be used or published.", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('-V','--version',help="Show version information", action='store_true', default=False)
parser.add_argument('-v','-V','--version',help="Show version information", action='version', version="FoLiA-tools v" + TOOLVERSION + ", using FoLiA v" + folia.FOLIAVERSION + " with library FoLiApy v" + folia.LIBVERSION, default=False)
commandparser(parser)
parser.add_argument('files', nargs='*', help='Files (and/or directories) to validate')
args = parser.parse_args()

if args.version:
print("FoLiA " + folia.FOLIAVERSION + ", library version " + folia.LIBVERSION,file=sys.stderr)
sys.exit(0)

schema = lxml.etree.RelaxNG(folia.relaxng())

if args.files:
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.2", #also change in __init__.py
version = "2.0.3", #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 6873add

Please sign in to comment.