List of usage examples for weka.core.converters XRFFLoader XRFFLoader
XRFFLoader
From source file:adams.data.io.input.XrffSpreadSheetReader.java
License:Open Source License
/** * Returns an instance of the file loader. * /*from w w w . java 2s. co m*/ * @return the file loader */ @Override protected AbstractFileLoader newLoader() { return new XRFFLoader(); }
From source file:cn.ict.zyq.bestConf.util.DataIOFile.java
License:Open Source License
/** * Return the data set loaded from the Xrff file at @param path *///from www .j a v a 2 s . c om public static Instances loadDataFromXrffFile(String path) throws IOException { XRFFLoader loader = new XRFFLoader(); loader.setSource(new File(path)); Instances data = loader.getDataSet(); System.out.println("\nHeader of dataset:\n"); System.out.println(new Instances(data, 0)); return data; }
From source file:org.openscience.cdk.applications.taverna.io.XRFFFileReaderActivity.java
License:Open Source License
@Override public void work() throws Exception { // Get input/*from w w w. j a v a 2 s . com*/ List<File> files = this.getInputAsFileList(this.INPUT_PORTS[0]); // Do work List<Instances> datasets = new LinkedList<Instances>(); XRFFLoader loader = new XRFFLoader(); for (File file : files) { try { loader.setSource(file); Instances instances = loader.getDataSet(); datasets.add(instances); } catch (Exception e) { ErrorLogger.getInstance().writeError(CDKTavernaException.READ_FILE_ERROR + file, this.getActivityName(), e); } } // Set output this.setOutputAsObjectList(datasets, this.OUTPUT_PORTS[0]); }
From source file:org.openscience.cdk.applications.taverna.iterativeio.IterativeXRFFFileReaderActivity.java
License:Open Source License
@Override public void work() throws Exception { // Get input/*w w w . ja v a 2s . c o m*/ List<File> files = this.getInputAsFileList(this.INPUT_PORTS[0]); int readSize = this.getInputAsObject(this.INPUT_PORTS[1], Integer.class); // Do work List<T2Reference> outputList = new ArrayList<T2Reference>(); int index = 0; List<Instances> datasets = new LinkedList<Instances>(); XRFFLoader loader = new XRFFLoader(); while (!files.isEmpty()) { File file = files.remove(0); try { loader.setSource(file); Instances instances = loader.getDataSet(); datasets.add(instances); } catch (Exception e) { ErrorLogger.getInstance().writeError(CDKTavernaException.READ_FILE_ERROR + file, this.getActivityName(), e); } if (files.isEmpty() || datasets.size() >= readSize) { T2Reference containerRef = this.setIterativeOutputAsList(datasets, this.OUTPUT_PORTS[0], index); outputList.add(index, containerRef); index++; datasets.clear(); } } // Set output this.setIterativeReferenceList(outputList, this.OUTPUT_PORTS[0]); }