use lib '/path/to/uplug'; use Uplug::Align::Word::Giza; $ENV{UPLUGHOME}='/path/to/uplug'; my %bitext = ('file' => 'svenprf.xces', 'format' => 'xces align'); &Bitext2Text(\%bitext,'src','trg',{}); # convert to plain text &RunGiza('src','trg','viterbi.src-trg'); # run GIZA++ (src-->trg) &RunGiza('trg','src','viterbi.trg-src'); # run GIZA++ (trg-->src) my %dbm = (file=>'clues.dbm', format=>'dbm', key => ['source','target']); &Giza2Clue('.', # directory where GIZA was running (=current) {}, # parameter (= clue dbm header) 1, # =1 --> inverse (trg-src) \%dbm); # clue DBM (giza.dbm if not specified) my $combine = 'intersection' # combine heuristics (union|refined) my %out = ('file' => $combined, # save the result in this file 'format' => 'xces align'); &Combined2Uplug('viterbi.src-trg', # name of first viterbi alignment 'viterbi.trg-src', # name of second viterbi alignment $combine, # type of combination heuristics \%bitext, # bitext {}, # token parameters \%out); # output stream
You have to tell the program where it can find the GIZA++ executables. You can either set the UPLUGHOME environment variable or the GIZAHOME variable.
$ENV{UPLUGHOME}='/path/to/uplug'; $Uplug::Align::Word::Giza::GIZAHOME="/path/to/uplug/ext/GIZA++";
To install Uplug, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Uplug
CPAN shell
perl -MCPAN -e shell install Uplug
For more information on module installation, please visit the detailed CPAN module installation guide.