/** * Sets the label lexicon. * * @param l A feature lexicon. **/ public void setLabelLexicon(Lexicon l) { super.setLabelLexicon(l); if (network != null) { int N = network.size(); for (int i = 0; i < N; ++i) { Learner learner = (Learner) network.get(i); if (learner != null) learner.setLabelLexicon(l); } } }
if (labelLexicon != null && labelLexicon.size() > 0 && learner.getLabelLexicon().size() == 0) learner.setLabelLexicon(labelLexicon);
preExtractLearner.setLabelLexicon(learner.getLabelLexicon()); Lexicon lexicon = learner.getLexicon(); preExtractLearner.setLexicon(lexicon); parser = new ArrayFileParser(baos.toByteArray(), zip); learner.setLabelLexicon(preExtractLearner.getLabelLexicon()); return preExtractLearner;
if (labelLexicon != null && labelLexicon.size() > 0 && learner.getLabelLexicon().size() == 0) learner.setLabelLexicon(labelLexicon);
weakLearners[i].setLabelLexicon(labelLexicon); weakLearners[i].learn((Object[]) sample); weakLearners[i].doneLearning();
l.setLabelLexicon(labelLexicon); network.set(selections[i], l);
/** * Reads the binary representation of any type of learner (including the label lexicon, but not * including the feature lexicon), with the option of cutting off the reading process after the * label lexicon and before any learned parameters. When <code>whole</code> is * <code>false</code>, the reading process is cut off in this way. * * <p> * This method is appropriate for reading learners as written by * {@link #write(ExceptionlessOutputStream)}. * * @param in The input stream. * @param whole Whether or not to read the whole model. * @return The learner read from the stream. **/ public static Learner readLearner(ExceptionlessInputStream in, boolean whole) { String name = in.readString(); if (name == null) return null; Learner result = ClassUtils.getLearner(name); result.unclone(); if (whole) result.read(in); // Overridden by decendents else { result.readLabelLexicon(in); // Should not be overridden by decendents Lexicon labelLexicon = result.getLabelLexicon(); result.forget(); result.setLabelLexicon(labelLexicon); } return result; }