#!/usr/bin/perl

# Perl program to gather i-vectors written
# out in .y files into a single X matrix
#
# Author: Xavier Bost
# email: xavier.bost@univ-avignon.fr
#
# Synopsis:
#
# Source file: spkDiarization/data/data.lst
#
# Retained informations are written in:
# spkDiarization/iv/X.dat
#

use strict;

my $line;                  # current source file line
my $file_in;               # file containing i-vector
my $i_vec;                 # i-vector

open(IN1, "spkDiarization/data/data.lst");
open(OUT, "> spkDiarization/iv/X.dat");

# parsing input file
while ($line = <IN1>) {
    chomp($line);

    $file_in = "spkDiarization/iv/raw/$line.y";

    open(IN2, $file_in);
    $i_vec = <IN2>;
    $i_vec = <IN2>;

    print OUT "$i_vec";

    close(IN2);
}

close(OUT);
close(IN1);
