X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FText%2FTradition%2FAnalysis.pm;h=a9b3318ec012508753bd0ac114c9fb09cb642f21;hb=0a8f09a9a3eb1cb6861db715c2b6ed43e1e11402;hp=7d1c7aa63e5775eabd8dd80b8340566afbbaaacd;hpb=c4e11e3f493b478df064ae3a32cd2083c38272fe;p=scpubgit%2Fstemmatology.git diff --git a/lib/Text/Tradition/Analysis.pm b/lib/Text/Tradition/Analysis.pm index 7d1c7aa..a9b3318 100644 --- a/lib/Text/Tradition/Analysis.pm +++ b/lib/Text/Tradition/Analysis.pm @@ -9,8 +9,9 @@ sub new { my( $class, $args ) = @_; my $self = {}; # Our object needs to have a stemma graph and a variant table. - my( $svg, $variants ) = run_analysis( $args->{'file'}, $args->{'stemmadot'} ); + my( $title, $svg, $variants ) = run_analysis( $args->{'file'}, $args->{'stemmadot'} ); $self->{'svg'} = $svg; + $self->{'title'} = $title; $self->{'variants'} = $variants; bless( $self, $class ); @@ -104,12 +105,13 @@ sub run_analysis { # For all the groups with more than one member, collect the list of all # contiguous vertices needed to connect them. # TODO: deal with a.c. reading logic - my $sc = analyze_variant_location( $group_readings, $groups, $stemma->apsp ); - $variant_row->{'genealogical'} = keys %$sc ? 1 : undef; + my $conflict = analyze_variant_location( $group_readings, $groups, $stemma->apsp ); + $variant_row->{'genealogical'} = keys %$conflict ? undef : 1; foreach my $grp ( sort keys %$group_readings ) { my $rdg = $group_readings->{$grp}; + my $in_conflict = exists $conflict->{$rdg}; push( @{$variant_row->{'readings'}}, - { 'text' => $rdg, 'group' => $grp, + { 'text' => $rdg, 'group' => $grp, 'conflict' => $in_conflict, 'missing' => wit_stringify( $lacunose ) } ); } @@ -132,7 +134,7 @@ sub run_analysis { $row->{'empty'} = $empty; } - return( $svg, $variants ); + return( $tradition->name, $svg, $variants ); } sub analyze_variant_location {