public void run() {
        if(inputLength > testLength*2) {
            try {
                Set<Integer> tuningInt = createRandomNumbers(testLength,inputLength);
                Set<Integer> testInt = createRandomNumbers(testLength,inputLength,tuningInt);
                
                BufferedReader f = new BufferedReader(new FileReader(input));
                
                FileWriter trainsource = new FileWriter(outputDir+"/train.source");
                FileWriter traintarget = new FileWriter(outputDir+"/train.target");
                FileWriter trainalign = new FileWriter(outputDir+"/train.align");
                
                FileWriter testsource = new FileWriter(outputDir+"/test.source");
                FileWriter testtarget = new FileWriter(outputDir+"/test.target");
                FileWriter testalign = new FileWriter(outputDir+"/test.align");
                
                FileWriter tuningsource = new FileWriter(outputDir+"/tuning.source");
                FileWriter tuningtarget = new FileWriter(outputDir+"/tuning.target");
                FileWriter tuningalign = new FileWriter(outputDir+"/tuning.align");
                
                String line = null;
                int i = 0;
                int tr =0,tu=0,te=0;
                
                FileWriter source, target, align;
                
                while((line = f.readLine()) != null) {
                    String [] parts = line.split(" \\|\\|\\| ");
                    
                    if(tuningInt.contains(i)) {
                        source = tuningsource;
                        target = tuningtarget;
                        align = tuningalign;
                        tu++;
                    } else if (testInt.contains(i)) {
                        source = testsource;
                        target = testtarget;
                        align = testalign;
                        te++;
                    } else {
                        source = trainsource;
                        target = traintarget;
                        align = trainalign;
                        tr++;
                    }
                    
                    source.write(parts[0]+"\n");
                    target.write(parts[1]+"\n");
                    align.write(parts[2]+"\n");
                    ++i;
                    
                    if(i%100000==0) {
                        System.err.println("INFO: "+i+" lines written ("+tr+","+tu+","+te+").");
                    }
                    
                }
                System.err.println("INFO: "+i+" lines written ("+tr+","+tu+","+te+").");
                
                trainsource.close();traintarget.close();trainalign.close();
                tuningsource.close();tuningtarget.close();tuningalign.close();
                testsource.close();testtarget.close();testalign.close();
                
                
            } catch (Exception e) {
                e.printStackTrace(System.err);
            }
        } else {
            System.err.println("ERROR: Input file is too small");
        }
    }