public void processDocument(BufferedReader document, Wordsi wordsi) {
        try {
            // Handle the context header, if one exists.  Context headers are
            // assumed to be the first line in a document and to contain an
            // integer specifying which line the focus word is on..
            String contextHeader = handleContextHeader(document);
            String[] contextTokens = contextHeader.split("\\s+");
            int focusIndex = Integer.parseInt(contextTokens[3]);

            // Extract the dependency trees and skip any that are empty.
            DependencyTreeNode[] nodes = extractor.readNextTree(document);
            if (nodes.length == 0)
                return;
            DependencyTreeNode focusNode = nodes[focusIndex];

            // Get the focus word, i.e., the primary key, and the secondary key.
            String focusWord = getPrimaryKey(focusNode);
            String secondarykey = pseudoWordMap.get(focusWord);

            // Ignore any focus words that have no mapping.
            if (secondarykey == null)
                return;

            // Ignore any focus words that are unaccepted by Wordsi.
            if (!acceptWord(focusNode, contextTokens[1], wordsi))
                return;

            // Create a new context vector and send it to the Wordsi model.
            SparseDoubleVector focusMeaning = generator.generateContext(
                    nodes, focusIndex);
            wordsi.handleContextVector(secondarykey, focusWord, focusMeaning);

            // Close up the document.
            document.close();
        } catch (IOException ioe) {
            throw new IOError(ioe);
        }
    }
public void processDocument ( BufferedReader document , Wordsi wordsi ) { try { String contextHeader = handleContextHeader ( document ) ; String [ ] contextTokens = contextHeader . split ( "\\s+" ) ; int focusIndex = Integer . parseInt ( contextTokens [ 3 ] ) ; DependencyTreeNode [ ] nodes = extractor . readNextTree ( document ) ; if ( nodes . length == 0 ) return ; DependencyTreeNode focusNode = nodes [ focusIndex ] ; String focusWord = getPrimaryKey ( focusNode ) ; String secondarykey = pseudoWordMap . get ( focusWord ) ; if ( secondarykey == null ) return ; if ( ! acceptWord ( focusNode , contextTokens [ 1 ] , wordsi ) ) return ; SparseDoubleVector focusMeaning = generator . generateContext ( nodes , focusIndex ) ; wordsi . handleContextVector ( secondarykey , focusWord , focusMeaning ) ; document . close ( ) ; } catch ( IOException ioe ) { throw new IOError ( ioe ) ; } }
{@inheritDoc}