From a7540443f59856f363b7101ab4db23c4818504e3 Mon Sep 17 00:00:00 2001 From: Anthony Fader Date: Fri, 11 Oct 2013 16:41:40 -0700 Subject: [PATCH] changed code to work in bash --- scripts/training/run-giza.pl | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/training/run-giza.pl b/scripts/training/run-giza.pl index 2b09d004..69afddbc 100755 --- a/scripts/training/run-giza.pl +++ b/scripts/training/run-giza.pl @@ -229,17 +229,17 @@ sub word_align { my($__ALIGNMENT_CMD,$__ALIGNMENT_INV_CMD); if (-e "$___GIZA_F2E/$___F-$___E.$___GIZA_EXTENSION.bz2"){ - $__ALIGNMENT_CMD="\"$BZCAT $___GIZA_F2E/$___F-$___E.$___GIZA_EXTENSION.bz2\""; + $__ALIGNMENT_CMD="<($BZCAT $___GIZA_F2E/$___F-$___E.$___GIZA_EXTENSION.bz2)"; } elsif (-e "$___GIZA_F2E/$___F-$___E.$___GIZA_EXTENSION.gz") { - $__ALIGNMENT_CMD="\"$ZCAT $___GIZA_F2E/$___F-$___E.$___GIZA_EXTENSION.gz\""; + $__ALIGNMENT_CMD="<($ZCAT $___GIZA_F2E/$___F-$___E.$___GIZA_EXTENSION.gz)"; } else { die "ERROR: Can't read $___GIZA_F2E/$___F-$___E.$___GIZA_EXTENSION.{bz2,gz}\n"; } if ( -e "$___GIZA_E2F/$___E-$___F.$___GIZA_EXTENSION.bz2"){ - $__ALIGNMENT_INV_CMD="\"$BZCAT $___GIZA_E2F/$___E-$___F.$___GIZA_EXTENSION.bz2\""; + $__ALIGNMENT_INV_CMD="<($BZCAT $___GIZA_E2F/$___E-$___F.$___GIZA_EXTENSION.bz2)"; }elsif (-e "$___GIZA_E2F/$___E-$___F.$___GIZA_EXTENSION.gz"){ - $__ALIGNMENT_INV_CMD="\"$ZCAT $___GIZA_E2F/$___E-$___F.$___GIZA_EXTENSION.gz\""; + $__ALIGNMENT_INV_CMD="<($ZCAT $___GIZA_E2F/$___E-$___F.$___GIZA_EXTENSION.gz)"; }else{ die "ERROR: Can't read $___GIZA_E2F/$___E-$___F.$___GIZA_EXTENSION.{bz2,gz}\n\n"; } @@ -264,8 +264,8 @@ sub word_align { safesystem("$GIZA2BAL -d $__ALIGNMENT_INV_CMD -i $__ALIGNMENT_CMD |". "$SYMAL -alignment=\"$__symal_a\" -diagonal=\"$__symal_d\" ". - "-final=\"$__symal_f\" -both=\"$__symal_b\" > ". - "$___ALIGNMENT_FILE.$___ALIGNMENT") + "-final=\"$__symal_f\" -both=\"$__symal_b\"". + " -o=$___ALIGNMENT_FILE.$___ALIGNMENT") || die "ERROR: Can't generate symmetrized alignment file\n" @@ -416,6 +416,8 @@ sub run_single_snt2cooc { } sub safesystem { + unshift (@_, '-c'); + unshift (@_, 'bash'); print STDERR "Executing: @_\n"; system(@_); if ($? == -1) {