diff --git a/m2_to_m2.py b/m2_to_m2.py index e2eeaff..18c32b9 100644 --- a/m2_to_m2.py +++ b/m2_to_m2.py @@ -68,7 +68,7 @@ def main(args): # Auto edits if args.auto: # Auto align the parallel sentences and extract the edits. - auto_edits = align_text.getAutoAlignedEdits(proc_orig, proc_cor, nlp, args) + auto_edits = align_text.getAutoAlignedEdits(proc_orig, proc_cor, args) # Loop through the edits. for auto_edit in auto_edits: # Give each edit an automatic error type. diff --git a/parallel_to_m2.py b/parallel_to_m2.py index 5e42428..6ee4d13 100644 --- a/parallel_to_m2.py +++ b/parallel_to_m2.py @@ -48,7 +48,7 @@ def main(args): # Markup the corrected sentence with spacy (assume tokenized) proc_cor = toolbox.applySpacy(cor_sent.strip().split(), nlp) # Auto align the parallel sentences and extract the edits. - auto_edits = align_text.getAutoAlignedEdits(proc_orig, proc_cor, nlp, args) + auto_edits = align_text.getAutoAlignedEdits(proc_orig, proc_cor, args) # Loop through the edits. for auto_edit in auto_edits: # Give each edit an automatic error type. diff --git a/scripts/align_text.py b/scripts/align_text.py index 59279cb..e9b68da 100644 --- a/scripts/align_text.py +++ b/scripts/align_text.py @@ -6,7 +6,6 @@ import scripts.rdlextra as DL # Some global variables -NLP = None CONTENT_POS = {POS.ADJ, POS.ADV, POS.NOUN, POS.VERB} ### FUNCTIONS ### @@ -198,14 +197,10 @@ def levSubstitution(a,b,c,d): # Input 1: A Spacy annotated original sentence. # Input 2: A Spacy annotated corrected sentence. -# Input 3: A preloaded Spacy processing object. -# Input 4: Command line args. +# Input 3: Command line args. # Output: A list of lists. Each sublist is an edit of the form: # edit = [orig_start, orig_end, cat, cor, cor_start, cor_end] -def getAutoAlignedEdits(orig, cor, spacy, args): - # Save the spacy object globally. - global NLP - NLP = spacy +def getAutoAlignedEdits(orig, cor, args): # Get a list of strings from the spacy objects. orig_toks = [tok.text for tok in orig] cor_toks = [tok.text for tok in cor]