code: public void processDocument(BufferedReader document) throws IOException {
          Queue<String> prevWords = new ArrayDeque<String>();
          Queue<String> nextWords = new ArrayDeque<String>();
  
          Iterator<String> it = IteratorFactory.tokenizeOrdered(document);
          Map<String, DoubleVector> documentVectors =
              new HashMap<String, DoubleVector>();
  
          // Fill up the words after the context so that when the real processing
          // starts, the context is fully prepared.
          for (int i = 0 ; i < nextSize && it.hasNext(); ++i)
              nextWords.offer(it.next().intern());
          prevWords.offer(IteratorFactory.EMPTY_TOKEN);
  
          String focusWord = null;
          while (!nextWords.isEmpty()) {
              focusWord = nextWords.remove();
  
              if (it.hasNext())
                  nextWords.offer(it.next().intern());
  
              if (!focusWord.equals(IteratorFactory.EMPTY_TOKEN)) {
                  // Incorporate the context into the semantic vector for the
                  // focus word.  If the focus word has no semantic vector yet,
                  // create a new one, as determined by the index builder.
                  DoubleVector meaning = termHolographs.get(focusWord);
                  if (meaning == null) {
                      meaning = new DenseVector(indexVectorSize);
                      documentVectors.put(focusWord, meaning);
                  }
                  updateMeaning(meaning, prevWords, nextWords);
              }
  
              prevWords.offer(focusWord);
              if (prevWords.size() > 1)
                  prevWords.remove();
          }
  
          // Add the local cached semantics to the global term semantics.
          for (Map.Entry<String, DoubleVector> entry :
                  documentVectors.entrySet()) {
              synchronized (entry.getKey()) {
                  // Get the global semantic representation of each word.  If it
                  // does not currently exist, then just put the local copies
                  // representation, otherwise add the local copy to the global
                  // version.
                  DoubleVector existingVector =
                      termHolographs.get(entry.getKey());
                  if (existingVector == null)
                      termHolographs.put(entry.getKey(), entry.getValue());
                  else
                      VectorMath.add(existingVector, entry.getValue());
              }
          }
      }
docs: {@inheritDoc}