All Downloads are FREE. Search and download functionalities are using the official Maven repository.

weka.core.converters.XRFFSaver Maven / Gradle / Ivy

/*
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see .
 */

/*
 * XRFFSaver.java
 * Copyright (C) 2006-2012 University of Waikato, Hamilton, New Zealand
 *
 */

package weka.core.converters;

import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Vector;
import java.util.zip.GZIPOutputStream;

import weka.core.Capabilities;
import weka.core.Capabilities.Capability;
import weka.core.Instances;
import weka.core.Option;
import weka.core.RevisionUtils;
import weka.core.SingleIndex;
import weka.core.Utils;
import weka.core.xml.XMLInstances;

/**
 *  Writes to a destination that is in the XML version
 * of the ARFF format. The data can be compressed with gzip, in order to save
 * space.
 * 

* * * Valid options are: *

* *

 * -i <the input file>
 *  The input file
 * 
* *
 * -o <the output file>
 *  The output file
 * 
* *
 * -C <class index>
 *  The class index (first and last are valid as well).
 *  (default: last)
 * 
* *
 * -compress
 *  Compresses the data (uses '.xrff.gz' as extension instead of '.xrff')
 *  (default: off)
 * 
* * * * @author FracPete (fracpete at waikato dot ac dot nz) * @version $Revision: 10203 $ * @see Saver */ public class XRFFSaver extends AbstractFileSaver implements BatchConverter { /** for serialization */ private static final long serialVersionUID = -7226404765213522043L; /** the class index */ protected SingleIndex m_ClassIndex = new SingleIndex(); /** the generated XML document */ protected XMLInstances m_XMLInstances; /** whether to compress the output */ protected boolean m_CompressOutput = false; /** * Constructor */ public XRFFSaver() { resetOptions(); } /** * Returns a string describing this Saver * * @return a description of the Saver suitable for displaying in the * explorer/experimenter gui */ public String globalInfo() { return "Writes to a destination that is in the XML version of the ARFF format. " + "The data can be compressed with gzip, in order to save space."; } /** * Returns an enumeration describing the available options. * * @return an enumeration of all the available options. */ @Override public Enumeration




© 2015 - 2024 Weber Informatics LLC | Privacy Policy