...and remove debug statement
[scpubgit/stemmatology.git] / base / script / vectors.pl
index b3efd7b..1d2e021 100755 (executable)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 use feature 'say';
-use lib '/Users/tla/Projects/cpanmods/Text-SenseClusters-1.03/lib';
+use lib '/home/tla/cpanmods/Text-SenseClusters-1.03/lib';
 use Text::SenseClusters::Simat;
 use Text::Tradition;
 use Text::WagnerFischer qw/distance/;
@@ -13,7 +13,7 @@ binmode STDERR, ':utf8';
 
 # Get our arguments
 my( $traditionfile, $threshold ) = @ARGV;
-$threshold = 0.9 unless $threshold;
+$threshold = 0.99 unless $threshold;
 
 # Load up a tradition
 my $t;
@@ -29,13 +29,11 @@ my $c = $t->collation;
 my ( $matrix ) = make_matrix( $t );
 
 # For each relationship in the graph, see how it compares to other node pairs
-# rated > .9
+# rated > $threshold
 
 foreach my $pair ( $c->relationships ) {
        my $rel = $c->get_relationship( $pair );
        my( $rx, $ry ) = map { $c->reading( $_ ) } sort @$pair;
-       next if $rx->rank > 100;
-       next if $ry->rank > 100;
 
        say STDERR "Checking relationship $rx -- $ry, of type " . $rel->type;
        my $matches = 0;
@@ -76,14 +74,12 @@ sub make_matrix {
        my %analyzed;
        my $rct = 0;
        foreach my $rx ( $c->readings ) {
-               next if $rx->rank > 100;
                next if $rx->is_meta();
                # Have to compare each reading with each other, so do this only once
                $analyzed{"$rx"} = 1;
                $rct++;
                say STDERR "Looking at reading $rct ( $rx )";
                foreach my $ry ( $c->readings ) {
-                       next if $ry->rank > 100;
                        next if $ry->is_meta();
                        next if $analyzed{"$ry"};
                
@@ -173,13 +169,3 @@ sub make_matrix {
        
        return $cosine_values;
 }
-
-sub calc_similarity {
-       my( $matrix, $vecindex ) = @_;
-       
-       my $values = {};
-       foreach my $val ( sort { $a <=> $b } keys %$values ) {
-               my $pairlist = join( ', ', @{$values->{$val}} );
-               say "$val: $pairlist";
-       }
-}
\ No newline at end of file