Synopsis
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
GIZA++ directories
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++";