#!/usr/bin/perl -s
#
use strict;
use warnings;
use Data::Dumper;
use utf8;
use FindBin qw($Bin);
use lib "$Bin/../lib";
require "$Bin/common.pl";

our ($o, $t, $r); ## options (output file, filter threshold, show rank)

sub dump_bws {
    my $biwords = shift;

    open STDOUT, '>', $o if $o;

    for my $bw (@{$biwords}){

        my $r = $bw->{'r'};
        my $l = $bw->{'l'};
        my $rank = $bw->{'rank'};

        print STDOUT "$rank,$l,$r\n";
    }

    close STDOUT if $o;

}

my $l1 = shift;
my $l2 = shift;
my $threshold = shift || 0.4;

dump_bws( gen_biwords( $l1, $l2, t => $threshold)  );

