code: public void processDocument(BufferedReader document) throws IOException {
          // Iterate over all of the parseable dependency parsed sentences in the
          // document.
          for (DependencyTreeNode[] nodes = null;
                  (nodes = parser.readNextTree(document)) != null; ) {
  
              // Skip empty documents.
              if (nodes.length == 0)
                  continue;
  
              // Examine the paths for each word in the sentence.
              for (int i = 0; i < nodes.length; ++i) {
                  String focusWord = nodes[i].word();
  
                  // Skip words that are rejected by the semantic filter.
                  if (!acceptWord(focusWord))
                      continue;
  
                  // Acquire the semantic vector for the focus word.
                  IntegerVector focusMeaning = getSemanticVector(focusWord);
  
                  // Create the path iterator for all acceptable paths rooted at
                  // the focus word in the sentence.
                  Iterator<DependencyPath> pathIter = 
                      new DependencyIterator(nodes[i], acceptor, pathLength);
  
                  // For every path, obtain the index vector of the last word in
                  // the path and add it to the semantic vector for the focus
                  // word.  The index vector is permuted if a permutation
                  // function has been provided based on the contents of the path.
                  while (pathIter.hasNext()) {
                      DependencyPath path = pathIter.next();
                      TernaryVector termVector = indexMap.get(path.last().word());
                      if (permFunc != null)
                          termVector = permFunc.permute(termVector, path);
                      add(focusMeaning, termVector);
                  }
              }
          }
          document.close();
      }
docs: {@inheritDoc}