code: public static File writeUCI(TrainingCorpus corpus, Lexicon lexicon,
              boolean b, String vector_location,
              Map<Integer, Integer> attributeMapping) throws IOException {
          File vectorFile = new File(vector_location);
          PrintWriter out = null;
          out = new PrintWriter(new FileWriter(vectorFile));
  
          // dump the content of the lexicon file
          int attributeNum = lexicon.getAttributesNum();
  
          // get an iterator on the Corpus
          // and retrieve the documents one by one
          Iterator<Document> docIterator = corpus.iterator();
          while (docIterator.hasNext()) {
              Document doc = docIterator.next();
              int label = doc.getLabel();
              // get a vector from the document
              // need a metric (e.g. relative frequency / binary)
              // and a lexicon
              // the vector is represented as a string directly
              Vector vector = null;
              if (attributeMapping == null)
                  vector = doc.getFeatureVector(lexicon);
              else
                  vector = doc.getFeatureVector(lexicon, attributeMapping);
  
              StringBuffer buffer = new StringBuffer();
  
              buffer.append(lexicon.getLabel(label));
  
              int[] indices = vector.getIndices();
              double[] values = vector.getValues();
  
              double[] denseVector = new double[attributeNum];
  
              for (int i = 0; i < indices.length; i++) {
                  int currentIndex = indices[i];
                  if (indices[i] > attributeNum)
                      continue;
                  denseVector[currentIndex] = values[i];
              }
  
              for (int i = 0; i < denseVector.length; i++) {
                  buffer.append(",").append(denseVector[i]);
              }
  
              buffer.append("\n");
              out.print(buffer.toString());
          }
          out.close();
          return vectorFile;
      }
docs: same as ARFF dense format but without headers *