|
a |
|
b/pipeline/main300/organizeclusters.java |
|
|
1 |
import java.util.*; |
|
|
2 |
import java.io.*; |
|
|
3 |
public class organizeclusters { |
|
|
4 |
public static void main(String[] args) throws Exception { |
|
|
5 |
Scanner in = new Scanner(new File("./parts/centers.txt")); |
|
|
6 |
HashMap<String, Integer> map = new HashMap<String, Integer>(); |
|
|
7 |
while (in.hasNext()) { |
|
|
8 |
String[] parts = in.nextLine().split(" "); |
|
|
9 |
int num = Integer.parseInt(parts[1].substring(0,parts[1].length()-1)); |
|
|
10 |
String text = parts[2]; |
|
|
11 |
for (int i = 3; i < parts.length; i++) text = text + " " + parts[i]; |
|
|
12 |
map.put(text, num); |
|
|
13 |
System.out.println(text + "FJIOSJFIOJDAJIO" + num); |
|
|
14 |
} |
|
|
15 |
System.out.println("--------------------------------------------------------------------"); |
|
|
16 |
int count = 0; |
|
|
17 |
PrintWriter centers = new PrintWriter(new File("./orderedclusters/centers.txt")); |
|
|
18 |
for (int i = 0; i < 70; i++) { |
|
|
19 |
Scanner ord = new Scanner(new File("./centerclusters/clust_" + i + ".txt")); |
|
|
20 |
while (ord.hasNext()) { |
|
|
21 |
String k = ord.nextLine(); |
|
|
22 |
k = k.substring(0, k.length()-1); |
|
|
23 |
System.out.println(k + "fji"); |
|
|
24 |
int j = map.get(k); |
|
|
25 |
centers.println("Cluster " + count + ": " + k); |
|
|
26 |
Scanner clust = new Scanner(new File("./parts/clust_" + j + ".txt")); |
|
|
27 |
PrintWriter out = new PrintWriter(new File("./orderedclusters/clust_" + count + ".txt")); |
|
|
28 |
while (clust.hasNext()) out.println(clust.nextLine()); |
|
|
29 |
count++; |
|
|
30 |
clust.close(); |
|
|
31 |
out.close(); |
|
|
32 |
} |
|
|
33 |
ord.close(); |
|
|
34 |
} |
|
|
35 |
in.close(); |
|
|
36 |
centers.close(); |
|
|
37 |
} |
|
|
38 |
} |