From e26434979adc33bd949566ba7bf02dff64e80a3e Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Tue, 2 Oct 2012 00:19:43 -0400 Subject: cdec cleanup, remove bayesian stuff, parsing stuff --- phrasinator/train-phrasinator.pl | 89 ---------------------------------------- 1 file changed, 89 deletions(-) delete mode 100755 phrasinator/train-phrasinator.pl (limited to 'phrasinator/train-phrasinator.pl') diff --git a/phrasinator/train-phrasinator.pl b/phrasinator/train-phrasinator.pl deleted file mode 100755 index c50b8e68..00000000 --- a/phrasinator/train-phrasinator.pl +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/bin/perl -w -use strict; -my $script_dir; BEGIN { use Cwd qw/ abs_path cwd /; use File::Basename; $script_dir = dirname(abs_path($0)); push @INC, $script_dir; } -use Getopt::Long; -use File::Spec qw (rel2abs); - -my $DECODER = "$script_dir/../decoder/cdec"; -my $TRAINER = "$script_dir/gibbs_train_plm_notables"; - -die "Can't find $TRAINER" unless -f $TRAINER; -die "Can't execute $TRAINER" unless -x $TRAINER; - -if (!GetOptions( - "decoder=s" => \$DECODER, -)) { usage(); } - -die "Can't find $DECODER" unless -f $DECODER; -die "Can't execute $DECODER" unless -x $DECODER; -if (scalar @ARGV != 2) { usage(); } -my $INFILE = shift @ARGV; -my $OUTDIR = shift @ARGV; -$OUTDIR = File::Spec->rel2abs($OUTDIR); -print STDERR " Input file: $INFILE\n"; -print STDERR "Output directory: $OUTDIR\n"; -open F, "<$INFILE" or die "Failed to open $INFILE for reading: $!"; -close F; -die "Please remove existing directory $OUTDIR\n" if (-f $OUTDIR || -d $OUTDIR); - -my $CMD = "mkdir $OUTDIR"; -safesystem($CMD) or die "Failed to create directory $OUTDIR\n$!"; - -my $grammar="$OUTDIR/grammar.gz"; -my $weights="$OUTDIR/weights"; -$CMD = "$TRAINER -w $weights -g $grammar -i $INFILE"; -safesystem($CMD) or die "Failed to train model!\n"; -my $cdecini = "$OUTDIR/cdec.ini"; -open C, ">$cdecini" or die "Failed to open $cdecini for writing: $!"; - -print C <> 8; - print STDERR "Exit code: $exitcode\n" if $exitcode; - return ! $exitcode; - } -} - -- cgit v1.2.3