/** * Used to lookup the children of conjunctive and referring features during training, this * method checks {@link #lexiconChildren} if the feature isn't present in {@link #lexicon} and * {@link #lexiconInv}, and then stores the given feature in {@link #lexiconChildren} if it * wasn't present anywhere. * * @param f The feature to look up. * @param label The label of the example containing this feature, or -1 if we aren't doing per * class feature counting. * @return A feature equivalent to <code>f</code> that is stored in this lexicon. **/ public Feature getChildFeature(Feature f, int label) { lazyMapCreation(); Integer I = (Integer) lexicon.get(f); if (I != null) { int index = I.intValue(); incrementCount(index, label); return lexiconInv.get(index); } if (lexiconChildren == null) lexiconChildren = new ChildLexicon(this); return lexiconChildren.getChildFeature(f, -1); }