/** * Load the embedding from a given arff file. First converts the ARFF to a temporary CSV file and * continues the loading mechanism with the CSV file afterwards * * @param path Path to the ARFF file */ private void loadEmbeddingFromArff(String path) { // Try loading ARFF file try { Instances insts = new Instances(new FileReader(path)); CSVSaver saver = new CSVSaver(); saver.setFieldSeparator(" "); saver.setInstances(insts); final File tmpFile = Paths.get(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString() + ".csv") .toFile(); saver.setFile(tmpFile); saver.setNoHeaderRow(true); saver.writeBatch(); loadEmbeddingFromCSV(tmpFile); tmpFile.delete(); } catch (Exception e) { throw new RuntimeException( "ARFF file could not be read (" + wordVectorLocation.getAbsolutePath() + ")", e); } }
setNoHeaderRow(Utils.getFlag('N', options));
setNoHeaderRow(Utils.getFlag('N', options));