X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FText%2FTradition%2FCollation.pm;h=dda84852ee08ae2914484ba243577d9c99c9c2cd;hb=428bcf0bc79f77a7857b21ef881708faa792e33a;hp=5b3cd96c2c168abd51cba4998350d1153f7a75f7;hpb=c84a47788777f257a330f9d011c03077e622310e;p=scpubgit%2Fstemmatology.git diff --git a/lib/Text/Tradition/Collation.pm b/lib/Text/Tradition/Collation.pm index 5b3cd96..dda8485 100644 --- a/lib/Text/Tradition/Collation.pm +++ b/lib/Text/Tradition/Collation.pm @@ -11,8 +11,6 @@ use Text::Tradition::Collation::Reading; use Text::Tradition::Collation::RelationshipStore; use Text::Tradition::Error; use XML::Easy::Syntax qw( $xml10_namestartchar_rx $xml10_namechar_rx ); -use XML::LibXML; -use XML::LibXML::XPathContext; use Moose; has 'sequence' => ( @@ -448,6 +446,15 @@ sub compress_readings { # readings. my %gobbled; foreach my $rdg ( sort { $a->rank <=> $b->rank } $self->readings ) { + # While we are here, get rid of any extra wordforms from a disambiguated + # reading. + if( $rdg->disambiguated ) { + foreach my $lex ( $rdg->lexemes ) { + $lex->clear_matching_forms(); + $lex->add_matching_form( $lex->form ); + } + } + # Now look for readings that can be joined to their successors. next if $rdg->is_meta; next if $gobbled{$rdg->id}; next if $rdg->grammar_invalid || $rdg->is_nonsense; @@ -1021,6 +1028,7 @@ sub as_graphml { 'http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd'; # Create the document and root node + require XML::LibXML; my $graphml = XML::LibXML->createDocument( "1.0", "UTF-8" ); my $root = $graphml->createElementNS( $graphml_ns, 'graphml' ); $graphml->setDocumentElement( $root );