Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def main():
# pr = cProfile.Profile()
# pr.enable()
# Parse command line args
args = parse_args()
print("Loading resources...")
# Load Errant
annotator = errant.load("en")
# Open output m2 file
out_m2 = open(args.out, "w")
print("Processing parallel files...")
# Process an arbitrary number of files line by line simultaneously. Python 3.3+
# See https://tinyurl.com/y4cj4gth
with ExitStack() as stack:
in_files = [stack.enter_context(open(i)) for i in [args.orig]+args.cor]
# Process each line of all input files
for line in zip(*in_files):
# Get the original and all the corrected texts
orig = line[0].strip()
cors = line[1:]
# Skip the line if orig is empty
if not orig: continue
# Parse orig with spacy