[c09aa8]: / clusters / scripts / clustall9k.java

Download this file

26 lines (25 with data), 882 Bytes

 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
import java.util.*;
import java.io.*;
public class clustall9k {
public static void main(String[] args) throws Exception {
for (int i = 0; i < 600; i++) {
Scanner cent = new Scanner(new File("./mega9kclust/mgclust_" + i + ".txt"));
PrintWriter out = new PrintWriter(new File("./clustall9k/" + i + ".txt"));
while (cent.hasNext()) {
String k = cent.nextLine();
int j = Integer.parseInt(k.split(" ")[1].substring(0, k.split(" ")[1].length()-1));
System.out.println(j);
Scanner txt = new Scanner(new File("./final9knumclusters/clust_" + j + ".txt"));
while (txt.hasNext()) out.println(txt.nextLine());
}
out.close();
cent.close();
}
}
static String removeClust(String input, int len) {
String[] terms = input.split(" ");
String out = terms[len];
for (int i = len; i < terms.length; i++) out = out + " " + terms[i];
return out;
}
}