remove some debugging statements
[scpubgit/stemmatology.git] / lib / Text / Tradition / Parser / Util.pm
index 9110655..de18a6f 100644 (file)
@@ -31,13 +31,21 @@ on the collation graph.
 
 sub collate_variants {
     my( $collation, @reading_sets ) = @_;
+    
+    # Make sure the reading sets are unique, but retain their ordering.
+    my %unique_sets;
+    my @sets;
+    foreach( @reading_sets ) {
+       push( @sets, $_ ) unless $unique_sets{$_};
+       $unique_sets{$_} = $_;
+    }
 
     # Two different ways to do this, depending on whether we want
     # transposed reading nodes to be merged into one (producing a
     # nonlinear, bidirectional graph) or not (producing a relatively
     # linear, unidirectional graph.)
-    return $collation->linear ? _collate_linearly( @_ )
-        : _collate_nonlinearly( @_ );
+    return $collation->linear ? _collate_linearly( $collation, @sets )
+        : _collate_nonlinearly( $collation, @sets );
 }
 
 sub _collate_linearly {