public static void main(String[] args) { runFileSaver(new DictionarySaver(), args); } }
public DictionarySaver() { resetOptions(); }
@Override public void writeIncremental(Instance inst) throws IOException { int writeMode = getWriteMode(); Instances structure = getInstances(); if (getRetrieval() == BATCH || getRetrieval() == NONE) { throw new IOException("Batch and incremental saving cannot be mixed."); setWriteMode(CANCEL); if (inst != null) { throw new IOException("Structure (header Information) has to be set " setWriteMode(STRUCTURE_READY); writeMode = getWriteMode(); cancel(); setWriteMode(WRITE); writeMode = getWriteMode(); if (retrieveFile() == null && getWriter() == null) { if (getSaveBinaryDictionary()) { throw new IOException( "Can't output binary dictionary to standard out!"); if (getSaveBinaryDictionary()) { m_dictionaryBuilder.saveDictionary(m_binaryStream); } else { m_dictionaryBuilder.saveDictionary(getWriter());
@Override public void writeBatch() throws IOException { if (getInstances() == null) { throw new IOException("No instances to save"); if (getRetrieval() == INCREMENTAL) { throw new IOException("Batch and incremental saving cannot be mixed."); setRetrieval(BATCH); setWriteMode(WRITE); m_dictionaryBuilder.setup(getInstances()); } catch (Exception ex) { throw new IOException(ex); for (int i = 0; i < getInstances().numInstances(); i++) { m_dictionaryBuilder.processInstance(getInstances().instance(i)); if (retrieveFile() == null && getWriter() == null) { if (getSaveBinaryDictionary()) { throw new IOException("Can't output binary dictionary to standard out!"); setWriteMode(WAIT); return; if (getSaveBinaryDictionary()) { m_dictionaryBuilder.saveDictionary(m_binaryStream); } else { m_dictionaryBuilder.saveDictionary(getWriter());
@Override public void writeIncremental(Instance inst) throws IOException { int writeMode = getWriteMode(); Instances structure = getInstances(); if (getRetrieval() == BATCH || getRetrieval() == NONE) { throw new IOException("Batch and incremental saving cannot be mixed."); setWriteMode(CANCEL); if (inst != null) { throw new IOException("Structure (header Information) has to be set " setWriteMode(STRUCTURE_READY); writeMode = getWriteMode(); cancel(); setWriteMode(WRITE); writeMode = getWriteMode(); if (retrieveFile() == null && getWriter() == null) { if (getSaveBinaryDictionary()) { throw new IOException( "Can't output binary dictionary to standard out!"); if (getSaveBinaryDictionary()) { m_dictionaryBuilder.saveDictionary(m_binaryStream); } else { m_dictionaryBuilder.saveDictionary(getWriter());
@Override public void writeBatch() throws IOException { if (getInstances() == null) { throw new IOException("No instances to save"); if (getRetrieval() == INCREMENTAL) { throw new IOException("Batch and incremental saving cannot be mixed."); setRetrieval(BATCH); setWriteMode(WRITE); m_dictionaryBuilder.setup(getInstances()); } catch (Exception ex) { throw new IOException(ex); for (int i = 0; i < getInstances().numInstances(); i++) { m_dictionaryBuilder.processInstance(getInstances().instance(i)); if (retrieveFile() == null && getWriter() == null) { if (getSaveBinaryDictionary()) { throw new IOException("Can't output binary dictionary to standard out!"); setWriteMode(WAIT); return; if (getSaveBinaryDictionary()) { m_dictionaryBuilder.saveDictionary(m_binaryStream); } else { m_dictionaryBuilder.saveDictionary(getWriter());
public static void main(String[] args) { runFileSaver(new DictionarySaver(), args); } }
public DictionarySaver() { resetOptions(); }