Mercurial > repos > stevecassidy > nltktools
diff g_chart_parser.py @ 2:a47980ef2b96 draft
planemo upload for repository https://github.com/Alveo/alveo-galaxy-tools commit b5b26e9118f2ad8af109d606746b39a5588f0511-dirty
author | stevecassidy |
---|---|
date | Wed, 01 Nov 2017 01:19:55 -0400 |
parents | fb617586f4b2 |
children |
line wrap: on
line diff
--- a/g_chart_parser.py Mon Dec 05 05:22:05 2016 -0500 +++ b/g_chart_parser.py Wed Nov 01 01:19:55 2017 -0400 @@ -1,15 +1,14 @@ import sys import nltk import argparse -from nltk.corpus import PlaintextCorpusReader + def arguments(): parser = argparse.ArgumentParser(description="run NER on a text") parser.add_argument('--input', required=True, action="store", type=str, help="input text file") - parser.add_argument('--grammar', required=True, action="store", type=str, help="grammar file") - parser.add_argument('--output', required=True, action="store", type=str, help="output file path") - args = parser.parse_args() - return args + parser.add_argument('--grammar', required=True, action="store", type=str, help="grammar file") + parser.add_argument('--output', required=True, action="store", type=str, help="output file path") + return parser.parse_args() def chart_parse(in_file, grammar_file, out_file): @@ -32,11 +31,13 @@ output.write('\n') except Exception as e: - message = "Error with parsing. Check the input files are correct and the grammar contains every word in the input sequence. \n----\n" + str(e) + "\n" + message = """Error with parsing. Check the input files are correct +and the grammar contains every word in the input sequence. \n----\n""" + str(e) + "\n" sys.stderr.write(message) sys.exit() output.close() + if __name__ == '__main__': args = arguments() chart_parse(args.input, args.grammar, args.output)