code: final public void train(StringWrapperIterator i) 
  	{
  		Set seenTokens = new HashSet();
  		while (i.hasNext()) {
  			StringWrapper s = (StringWrapper)i.next();
  			BagOfTokens bag = asBagOfTokens(i.nextStringWrapper());
  			for (Iterator j=bag.tokenIterator(); j.hasNext(); ) {
  				Token tokj = (Token)j.next();
  				totalTokens++;
  				// increment backgroundFrequency counts
  				Integer freq = (Integer)backgroundFrequency.get(tokj);
  				if (freq==null) backgroundFrequency.put(tokj,ONE); 
  				else if (freq==ONE) backgroundFrequency.put(tokj,TWO);
  				else if (freq==TWO) backgroundFrequency.put(tokj,THREE);
  				else backgroundFrequency.put(tokj, new Integer(freq.intValue()+1));
  			}
  		}
  	}
docs: Accumulate statistics on how often each token occurs.