Blame view

egs/yesno/s5/local/create_yesno_waves_test_train.pl 386 Bytes
8dcb6dfcb   Yannick Estève   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
  #!/usr/bin/env perl
  
  $full_list = $ARGV[0];
  $test_list = $ARGV[1];
  $train_list = $ARGV[2];
  
  open FL, $full_list;
  $nol = 0;
  while ($l = <FL>)
  {
  	$nol++;
  }
  close FL;
  
  $i = 0;
  open FL, $full_list;
  open TESTLIST, ">$test_list";
  open TRAINLIST, ">$train_list";
  while ($l = <FL>)
  {
  	chomp($l);
  	$i++;
  	if ($i <= $nol/2 )
  	{
  		print TRAINLIST "$l
  ";
  	}
  	else
  	{
  		print TESTLIST "$l
  ";
  	}
  }