public static CleartkProcessingException noInstanceOutcome(List<?> features) { String key = KEY_PREFIX + "noInstanceOutcome"; return new CleartkProcessingException(DEFAULT_RESOURCE_BUNDLE, key, features); }
@Override public void write(Instance<OUTCOME_T> instance) throws CleartkProcessingException { try { this.objout.writeObject(instance); } catch (IOException e) { throw new CleartkProcessingException("", "Unable to write Instance", e); } }
public static CleartkProcessingException multipleExceptions(List<? extends Throwable> causes) { String key = KEY_PREFIX + "multipleExceptions"; String message0 = causes.get(0).getMessage(); return new CleartkProcessingException( causes.get(0), DEFAULT_RESOURCE_BUNDLE, key, message0, causes.size() - 1); }
public static CleartkProcessingException unsupportedOperationSetParameter( Throwable cause, Object object, String methodName, String paramName, Object paramValue) { String key = KEY_PREFIX + "unsupportedOperationSetParameter"; return new CleartkProcessingException( cause, DEFAULT_RESOURCE_BUNDLE, key, object.getClass().getName(), methodName, paramName, paramValue); }
@Override public void finish() throws CleartkProcessingException { try { trainingDataWriter.writeObject(DATA_END); } catch (IOException e) { throw new CleartkProcessingException(e); } super.finish(); }
/** * Basic implementation of {@link DataWriter#finish()} and {@link SequenceDataWriter#finish()} * that calls {@link JarClassifierBuilder#saveToTrainingDirectory(File)} */ public void finish() throws CleartkProcessingException { try { this.classifierBuilder.saveToTrainingDirectory(this.outputDirectory); } catch (IOException e) { throw new CleartkProcessingException(e); } } }
@Override public void finish() throws CleartkProcessingException { try { // We need to add a "null" instance terminator to gracefully handle the iteration while // reading in serialized objects from file InstanceStream.Terminator<OUTCOME_T> terminator = new InstanceStream.Terminator<OUTCOME_T>(); this.objout.writeObject(terminator); this.objout.close(); } catch (IOException e) { throw new CleartkProcessingException("", "Unable to write terminal instance", e); } }
@Override public void finish() throws CleartkProcessingException { super.finish(); if(treeKernels.size() > 0){ ObjectOutputStream oos = null; ArrayTreeKernel atk = new ArrayTreeKernel(treeKernels); try{ oos = new ObjectOutputStream(new FileOutputStream(new File(this.outputDirectory, "tree-kernel.obj"))); oos.writeObject(atk); oos.close(); } catch (IOException e) { e.printStackTrace(); throw new CleartkProcessingException(e); } } } }
@Override public void finish() throws CleartkProcessingException { if(treeKernels.size() > 0){ ObjectOutputStream oos = null; ArrayTreeKernel atk = new ArrayTreeKernel(treeKernels); try{ oos = new ObjectOutputStream(new FileOutputStream(new File(this.outputDirectory, "tree-kernel.obj"))); oos.writeObject(atk); oos.close(); } catch (IOException e) { e.printStackTrace(); throw new CleartkProcessingException(e); } } super.finish(); } }
addClass(outcome); } catch (IOException e) { throw new CleartkProcessingException(e);
addClass(outcome); } catch (IOException e) { throw new CleartkProcessingException(e);
addClass(outcome); } catch (IOException e) { throw new CleartkProcessingException(e);
addClass(outcome); } catch (IOException e) { throw new CleartkProcessingException(e);
@Override public void write(List<Instance<OUTCOME_TYPE>> instances) throws CleartkProcessingException { try { for (Instance<OUTCOME_TYPE> instance : instances) { writeEncoded( this.classifierBuilder.getFeaturesEncoder().encodeAll(instance.getFeatures()), this.classifierBuilder.getOutcomeEncoder().encode(instance.getOutcome())); } writeSequenceEnd(); } catch (IOException e) { throw new CleartkProcessingException(e); } }
@Override public void write(Instance<Double> instance) throws CleartkProcessingException { if (!(instance instanceof QidInstance)) { throw new CleartkProcessingException("", "Unable to write non-QidInstance"); } String qid = ((QidInstance<Double>) instance).getQid(); writeEncoded( this.getEncodedQid(qid), this.classifierBuilder.getFeaturesEncoder().encodeAll(instance.getFeatures()), this.classifierBuilder.getOutcomeEncoder().encode(instance.getOutcome())); }
@Override public void write(Instance<Double> instance) throws CleartkProcessingException { if (!(instance instanceof QidInstance)) { throw new CleartkProcessingException("", "Unable to write non-QidInstance"); } String qid = ((QidInstance<Double>) instance).getQid(); writeEncoded( this.getEncodedQid(qid), this.classifierBuilder.getFeaturesEncoder().encodeAll(instance.getFeatures()), this.classifierBuilder.getOutcomeEncoder().encode(instance.getOutcome())); }