Skip to content

Commit

Permalink
Remove unnecessary arg
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Bryant committed Aug 13, 2019
1 parent 4d7f3c9 commit 0671210
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
2 changes: 1 addition & 1 deletion m2_to_m2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion parallel_to_m2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 2 additions & 7 deletions scripts/align_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ###
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit 0671210

Please sign in to comment.