code: private void addTermFrequencies(Reader r, Map<String, Int> termFreqMap, String fieldName) throws IOException
     {
        TokenStream ts = analyzer.tokenStream(fieldName, r);
        int tokenCount = 0;
        // for every token
        while (ts.incrementToken())
        {
           CharTermAttribute term = ts.getAttribute(CharTermAttribute.class);
           String word = new String(term.buffer(), 0, term.length());
           tokenCount++;
           if (tokenCount > maxNumTokensParsed)
           {
              break;
           }
           if (isNoiseWord(word))
           {
              continue;
           }
  
           // increment frequency
           Int cnt = termFreqMap.get(word);
           if (cnt == null)
           {
              termFreqMap.put(word, new Int());
           }
           else
           {
              cnt.x++;
           }
        }
        ts.end();
        ts.close();
     }
docs: Adds term frequencies found by tokenizing text from reader into the Map words
  @param r a source of text to be tokenized
  @param termFreqMap a Map of terms and their frequencies
  @param fieldName Used by analyzer for any special per-field analysis