Beispiel #1
0
 private void writeFile(SpectralClustering cluster) {
   FileUtil.clean(output);
   int[] lab = cluster.getClusterLabel();
   for (int x = 0; x < lab.length; x++) {
     final Doc doc = list.get(x);
     String one = doc.url + "\n" + doc.title + "\n" + doc.text + "\n" + hr;
     FileUtil.write(new File(output, lab[x] + ".txt"), one, true);
   }
 }
Beispiel #2
0
 private void _dimension() {
   FileUtil.clean(root);
   int x = 0;
   for (File file : root1.listFiles()) {
     Doc doc = buildDoc(x, file);
     //            System.out.println(doc.vector.getTFIDFValues());
     Iterator<Map.Entry<String, Double>> it = doc.vector.getTFIDFValues().entrySet().iterator();
     for (; it.hasNext(); ) {
       if (it.next().getValue() < 0.05) {
         it.remove();
       }
     }
     String str = StringUtils.join(doc.vector.getTFIDFValues().keySet().iterator(), " ");
     str = doc.url + "\n" + doc.title + "\n" + str + "\n" + doc.text;
     FileUtil.write(new File(root, file.getName()), str, false);
     x++;
   }
 }