Lingua-Align
view release on metacpan or search on metacpan
lib/Lingua/Align/LinkSearch.pm view on Meta::CPAN
greedyFinal ............ add step to link unlinked nodes (if wellformed)
greedyFinalAnd ......... add step to link still unlinked nodes
src2trg ................ source-to-target alignment (one link / source)
trg2src ................ target-to-source alignment (one link / target)
src2trgWellFormed ...... src2trg with wellformedness constraints
intersection ........... intersection between src2trg and trg2src
NTfirst ................ align non-terminals nodes first
NTonly ................. align only non-terminals
Tonly .................. align only termnal nodes
PaCoMT ................. used in PaCoMT project
cascaded ............... conbine search strategies (sequentially)
=cut
use 5.005;
use strict;
use FileHandle;
use Lingua::Align::LinkSearch::Threshold;
use Lingua::Align::LinkSearch::Greedy;
use Lingua::Align::LinkSearch::GreedyWellFormed;
lib/Lingua/Align/LinkSearch.pm view on Meta::CPAN
use Lingua::Align::LinkSearch::AssignmentWellFormed;
sub new{
my $class=shift;
my %attr=@_;
# my $type = $attr{-link_search} || 'greedy';
my $type = $attr{-link_search} || 'threshold';
if ($type=~/^cascaded/i){
return new Lingua::Align::LinkSearch::Cascaded(%attr);
}
if ($type=~/^viterbi/i){
return new Lingua::Align::LinkSearch::Viterbi(%attr);
}
if ($type=~/paco/i){
return new Lingua::Align::LinkSearch::PaCoMT(%attr);
}
# NT nodes first using the search strategy specified thereafter
lib/Lingua/Align/LinkSearch/Cascaded.pm view on Meta::CPAN
package Lingua::Align::LinkSearch::Cascaded;
#
# cascaded link search: define a sequence of link-search algorithms
# to be applied for incremental alignment
#
# The sequence is specified like this:
#
# -link_search = cascaded:strategy1-strategy2-...-strategyN
#
# (names of the strategies separated by '-') any strategy supported by
# LinkSearch is allowed here. For example:
#
# NTonlySrc2TrgWeaklyWellformed (align NT nodes only using a source-to-target
# strategy, checking for weak wellformedness)
# TonlyGreedyWellformed (align terminals only using a greedy alignment
# strategy (1:1 links only) and check for
# wellformedness)
# Src2TrgWeaklyWellformed (align nodes with a source-to-target strategy,
lib/Lingua/Align/LinkSearch/Cascaded.pm view on Meta::CPAN
my $class=shift;
my %attr=@_;
my $self={};
bless $self,$class;
foreach (keys %attr){
$self->{$_}=$attr{$_};
}
my $cascade = $self->{-link_search} ||
'cascaded:NTonlyGreedyWellformed-GreedyWeaklyWellformedFinal';
$cascade=~/^[^:]*:\s*(.*)\s*$/;
@{$self->{CASCADE}} = split(/\-/,$1);
@{$self->{LINKSEARCH}}=();
foreach (0..$#{$self->{CASCADE}}){
$self->{LINKSEARCH}->[$_] =
new Lingua::Align::LinkSearch(-link_search=>$self->{CASCADE}->[$_]);
}
# for tree manipulation
$self->{TREES} = new Lingua::Align::Corpus::Treebank();
lib/Lingua/Align/LinkSearch/Cascaded.pm view on Meta::CPAN
}
return 1;
}
1;
__END__
=head1 NAME
Lingua::Align::LinkSearch::Cascaded - cascaded link search strategies
=head1 SYNOPSIS
=head1 DESCRIPTION
This module allows to combine several alignment inference strategies into a "cascade of linking steps". Use the constructor option '-link_search' to specify the steps to be taken. The syntax is (strategies separated by '-'):
cascaded:strategy1-strategy2-...
("strategy1", "strategy2" ... are valid alignment strategies which will be applied in the order they are specified in the attribute value above)
=head1 SEE ALSO
=head1 AUTHOR
Joerg Tiedemann
=head1 COPYRIGHT AND LICENSE
( run in 0.536 second using v1.01-cache-2.11-cpan-49f99fa48dc )