@Test public void dictionary() throws IOException { ARFFModel model = new MapBackedARFFModel(); ARFFVectorIterableTest.getVectors("sample-dense.arff", model); StringWriter writer = new StringWriter(); Driver.writeLabelBindings(writer, model, ","); String expected1 = Resources.toString(Resources.getResource("expected-arff-dictionary.csv"), Charsets.UTF_8); String expected2 = Resources.toString(Resources.getResource("expected-arff-dictionary-2.csv"), Charsets.UTF_8); assertTrue(expected1.equals(writer.toString()) || expected2.equals(writer.toString())); }
protected static void writeLabelBindings(File dictOut, ARFFModel arffModel, String delimiter, boolean jsonDictonary) throws IOException { try (Writer writer = Files.newWriterSupplier(dictOut, Charsets.UTF_8, true).getOutput()) { if (jsonDictonary) { writeLabelBindingsJSON(writer, arffModel); } else { writeLabelBindings(writer, arffModel, delimiter); } } }
Driver { protected static void writeLabelBindings(File dictOut, ARFFModel arffModel, String delimiter, boolean jsonDictonary) throws IOException { try (Writer writer = Files.newWriterSupplier(dictOut, Charsets.UTF_8, true).getOutput()) { if (jsonDictonary) { writeLabelBindingsJSON(writer, arffModel); } else { writeLabelBindings(writer, arffModel, delimiter); } } } }
Driver { protected static void writeLabelBindings(File dictOut, ARFFModel arffModel, String delimiter, boolean jsonDictonary) throws IOException { try (Writer writer = Files.newWriterSupplier(dictOut, Charsets.UTF_8, true).getOutput()) { if (jsonDictonary) { writeLabelBindingsJSON(writer, arffModel); } else { writeLabelBindings(writer, arffModel, delimiter); } } } private  Driver(); }
Driver { protected static void writeLabelBindings(File dictOut, ARFFModel arffModel, String delimiter, boolean jsonDictonary) throws IOException { try (Writer writer = Files.newWriterSupplier(dictOut, Charsets.UTF_8, true).getOutput()) { if (jsonDictonary) { writeLabelBindingsJSON(writer, arffModel); } else { writeLabelBindings(writer, arffModel, delimiter); } } } private  Driver(); static void main(String[] args); }
Driver { protected static void writeLabelBindings(File dictOut, ARFFModel arffModel, String delimiter, boolean jsonDictonary) throws IOException { try (Writer writer = Files.newWriterSupplier(dictOut, Charsets.UTF_8, true).getOutput()) { if (jsonDictonary) { writeLabelBindingsJSON(writer, arffModel); } else { writeLabelBindings(writer, arffModel, delimiter); } } } private  Driver(); static void main(String[] args);  }