From: Tara L Andrews Date: Mon, 16 Jan 2012 15:34:27 +0000 (+0100) Subject: keep from deleting lacuna nodes prematurely X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=83d5ac3af5c70f09ee081885efcba827fcef4cb4;p=scpubgit%2Fstemmatology.git keep from deleting lacuna nodes prematurely --- diff --git a/lib/Text/Tradition/Collation/RelationshipStore.pm b/lib/Text/Tradition/Collation/RelationshipStore.pm index 39bbdc0..2479d08 100644 --- a/lib/Text/Tradition/Collation/RelationshipStore.pm +++ b/lib/Text/Tradition/Collation/RelationshipStore.pm @@ -311,6 +311,10 @@ sub merge_readings { $self->delete_reading( $deleted ); } +sub as_graphml { ## TODO + return; +} + no Moose; __PACKAGE__->meta->make_immutable; diff --git a/lib/Text/Tradition/Parser/Tabular.pm b/lib/Text/Tradition/Parser/Tabular.pm index 46fcbea..e632737 100644 --- a/lib/Text/Tradition/Parser/Tabular.pm +++ b/lib/Text/Tradition/Parser/Tabular.pm @@ -146,14 +146,11 @@ sub parse { my $last_rdg = shift @$p; my $new_p = [ $last_rdg ]; foreach my $rdg ( @$p ) { - if( $rdg->is_lacuna && $last_rdg->is_lacuna ) { - # If we are in a lacuna already, drop this node. - $c->del_reading( $rdg ); - } else { - # Save the reading, lacuna or no. - push( @$new_p, $rdg ); - $last_rdg = $rdg; - } + # Omit the reading if we are in a lacuna already. + next if $rdg->is_lacuna && $last_rdg->is_lacuna; + # Save the reading otherwise. + push( @$new_p, $rdg ); + $last_rdg = $rdg; } push( @$new_p, $c->end ); $wit->path( $new_p ); @@ -168,9 +165,13 @@ sub parse { $main_wit->uncorrected_path( $ac_wit->path ); $tradition->del_witness( $ac_wit ); } - + # Join up the paths. $c->make_witness_paths; + # Delete our unused lacuna nodes. + foreach my $rdg ( grep { $_->is_lacuna } $c->readings ) { + $c->del_reading( $rdg ) unless $c->reading_witnesses( $rdg ); + } } sub make_nodes { diff --git a/t/data/florilegium.csv b/t/data/florilegium.csv index 9598e80..908fd26 100644 --- a/t/data/florilegium.csv +++ b/t/data/florilegium.csv @@ -279,4 +279,3 @@ A,B,C,D,E,"E (a.c.)",F,G,H,K,P,"P (a.c.)",Q,"Q (a.c.)",S,T,"T (a.c.)" "δικαστήριον","δικαστήριον","δικαστήριον",#LACUNA#,#LACUNA#,#LACUNA#,#LACUNA#,#LACUNA#,#LACUNA#,#LACUNA#,"δικαστήριον","δικαστήριον",#LACUNA#,#LACUNA#,"δικαστήριον",#LACUNA#,#LACUNA# "ἕλκωσιν,","ἕλκωσιν,","ἕλκωσιν,",#LACUNA#,#LACUNA#,#LACUNA#,#LACUNA#,#LACUNA#,#LACUNA#,#LACUNA#,"ἕλκωσιν,","ἕλκωσιν,",#LACUNA#,#LACUNA#,"ἕλκωσιν,",#LACUNA#,#LACUNA# "ἀκολούθησον.","ἀκολούθησον.","ἀκολούθησον.",#LACUNA#,#LACUNA#,#LACUNA#,#LACUNA#,#LACUNA#,#LACUNA#,#LACUNA#,"ἀκολούθησον.","ἀκολούθησον.",#LACUNA#,#LACUNA#,"ἀκολούθησον.",#LACUNA#,#LACUNA# -#END#,#END#,#END#,#END#,#END#,#END#,#END#,#END#,#END#,#END#,#END#,#END#,#END#,#END#,#END#,#END#,#END#