#!/usr/bin/perl  
# Copyright (C) 2009-2011  Antonio Bonafonte
#            Universitat Politècnica de Catalunya, Barcelona, Spain
#
#  This script is free software; you can redistribute it and/or
#  modify it under the terms of the GNU Lesser General Public
#  License as published by the Free Software Foundation,
#  version 2.1 of the License.
#
#  This library is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#  Lesser General Public License for more details.
#
#  You should have received a copy of the GNU Lesser General Public
#  License along with this library; if not, write to the Free Software
#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

open (TRAIN, ">work/corpus.train");
open (TEST, ">work/corpus.test"); 
open (TRAIN_SENTENCES, ">work/corpus_frases.train");
open (TEST_SENTENCES, ">work/corpus_frases.test");
open (FR, 'work/corpus-ca-frase.out');
open (AR, 'work/corpus-ca.out');

 $cont=0;
 while(<AR>)
  { 
    if($cont%20 eq 0) {
    print TEST $_;
    $cont++;
    }
    else { 
    print TRAIN $_;
    $cont++;
    }
  }
 $cont=0;
 while(<FR>)
  { 
    if($cont%20 eq 0) {
    print TEST_SENTENCES $_;
    $cont++;
    }
    else { 
    print TRAIN_SENTENCES $_;
    $cont++;
    }
  }

close(TRAIN_SENTENCES);
close(TEST_SENTENCES);
close(FR);
close(AR);
close(TEST);
close(TRAIN);
