From: Tara L Andrews Date: Wed, 24 Apr 2013 05:58:02 +0000 (+0200) Subject: field tested but unchecked changes, review ASAP X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b39e7cb5cc6b77a19cac9bd83bf23105d8f75cc4;p=scpubgit%2Fstemmatology.git field tested but unchecked changes, review ASAP --- diff --git a/analysis/lib/Text/Tradition/StemmaUtil.pm b/analysis/lib/Text/Tradition/StemmaUtil.pm index 1aba28b..a345b29 100644 --- a/analysis/lib/Text/Tradition/StemmaUtil.pm +++ b/analysis/lib/Text/Tradition/StemmaUtil.pm @@ -50,8 +50,8 @@ sub character_input { if( $opts->{exclude_layer} ) { # Filter out all alignment table rows that do not correspond # to a named witness - these are the layered witnesses. - my $newtable = { alignment => [] }; - foreach my $row ( $table->{alignment} ) { + my $newtable = { alignment => [], length => $table->{length} }; + foreach my $row ( @{$table->{alignment}} ) { if( $tradition->has_witness( $row->{witness} ) ) { push( @{$newtable->{alignment}}, $row ); } @@ -179,7 +179,7 @@ sub phylip_pars { # And then we run the program. my $program = File::Which::which( 'pars' ); - unless( -x $program ) { + unless( $program && -x $program ) { throw( "Phylip pars not found in path" ); } diff --git a/base/lib/Text/Tradition/Collation.pm b/base/lib/Text/Tradition/Collation.pm index 3b9af97..a2843e4 100644 --- a/base/lib/Text/Tradition/Collation.pm +++ b/base/lib/Text/Tradition/Collation.pm @@ -1258,14 +1258,14 @@ format which looks like this: sub alignment_table { my( $self ) = @_; - $self->calculate_ranks() unless $self->_graphcalc_done; return $self->cached_table if $self->has_cached_table; # Make sure we can do this throw( "Need a linear graph in order to make an alignment table" ) unless $self->linear; - $self->calculate_ranks unless $self->end->has_rank; - + $self->calculate_ranks() + unless $self->_graphcalc_done && $self->end->has_rank; + my $table = { 'alignment' => [], 'length' => $self->end->rank - 1 }; my @all_pos = ( 1 .. $self->end->rank - 1 ); foreach my $wit ( sort { $a->sigil cmp $b->sigil } $self->tradition->witnesses ) { diff --git a/base/lib/Text/Tradition/Parser/CTE.pm b/base/lib/Text/Tradition/Parser/CTE.pm index 85d37da..69bb482 100644 --- a/base/lib/Text/Tradition/Parser/CTE.pm +++ b/base/lib/Text/Tradition/Parser/CTE.pm @@ -366,7 +366,7 @@ sub interpret { if( $oldreading ne $reading || $flag || $oldreading =~ /\./ ) { my $int = $reading; $int .= " ($flag)" if $flag; - say STDERR "Interpreted $oldreading as $int given $lemma"; + # say STDERR "Interpreted $oldreading as $int given $lemma"; } return( $reading, $flag ); } diff --git a/base/script/make_tradition.pl b/base/script/make_tradition.pl index 7b8af5b..1c2cc8e 100755 --- a/base/script/make_tradition.pl +++ b/base/script/make_tradition.pl @@ -110,7 +110,7 @@ if( $stemmafile ) { # Now output what we have been asked to. if( $outformat eq 'stemma' ) { - my $cdata = character_input( $tradition->collation->alignment_table ); + my $cdata = character_input( $tradition ); try { print phylip_pars( $cdata ); } catch( Text::Tradition::Error $e ) {