#!/usr/bin/tclsh # Copyright (C) 2005-2007 Richard Moot (Richard.Moot@labri.fr) # Copyright (C) 2005-2007 CNRS (http://www.cnrs.fr) # Copyright (C) 2005-2007 INRIA (http://www.inria.fr) # This library 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; either # version 2.1 of the License, or (at your option) any later version. # 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Partition the maximum entropy data into a training partition # and a test partition. The variable "interval" below decides the # interval between different sentences which are added to the # test partition. set interval 5 set file1 [lindex $argv 0] set file2 [lindex $argv 1] set file3 [lindex $argv 2] set f1 [open $file1 r] set f2 [open $file2 w] set f3 [open $file3 w] set count 0 while {[gets $f1 line]&&[eof $f1]==0} { incr count if {$count == $interval} { puts $f3 $line set count 0 } else { puts $f2 $line } } close $f1 close $f2 close $f3