From: Tara L Andrews Date: Mon, 25 Jun 2012 20:52:59 +0000 (+0200) Subject: don't flatten readings with different lexeme states X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=scpubgit%2Fstemmatology.git;a=commitdiff_plain;h=07e6765f326ee9b843b8a652e1cf601ff9bb740c don't flatten readings with different lexeme states --- diff --git a/lib/Text/Tradition/Collation.pm b/lib/Text/Tradition/Collation.pm index a817385..0f6e657 100644 --- a/lib/Text/Tradition/Collation.pm +++ b/lib/Text/Tradition/Collation.pm @@ -1603,8 +1603,17 @@ sub flatten_ranks { next unless $rdg->has_rank; my $key = $rdg->rank . "||" . $rdg->text; if( exists $unique_rank_rdg{$key} ) { + # Make sure they don't have different grammatical forms + my $ur = $unique_rank_rdg{$key}; + if( $rdg->disambiguated && $ur->disambiguated ) { + my $rform = join( '//', map { $_->form->to_string } $rdg->lexemes ); + my $uform = join( '//', map { $_->form->to_string } $ur->lexemes ); + next unless $rform eq $uform; + } elsif( $rdg->disambiguated xor $ur->disambiguated ) { + next; + } # Combine! - # print STDERR "Combining readings at same rank: $key\n"; + print STDERR "Combining readings at same rank: $key\n"; $changed = 1; $self->merge_readings( $unique_rank_rdg{$key}, $rdg ); # TODO see if this now makes a common point.