Package edu.ucla.sspace.dependency

Examples of edu.ucla.sspace.dependency.DependencyTreeNode


    /**
     * {@inheritDoc}
     */
    public SparseDoubleVector generateContext(DependencyTreeNode[] tree,
                                              int focusIndex) {
        DependencyTreeNode focusNode = tree[focusIndex];

        SparseDoubleVector focusMeaning = new CompactSparseVector();
        // Get all the valid paths starting from this word.
        Iterator<DependencyPath> paths = new FilteredDependencyIterator(
                focusNode, acceptor, pathLength);
View Full Code Here


                Iterator<DependencyPath> pathIter =
                    new FilteredDependencyIterator(nodes[i], acceptor, 1);

                while (pathIter.hasNext()) {
                    DependencyPath path = pathIter.next();
                    DependencyTreeNode last = path.last();

                    // Reject words that are not nouns, verbs, or adjectives.
                    if (!(last.pos().startsWith("N") ||
                          last.pos().startsWith("J") ||
                          last.pos().startsWith("V")))
                        continue;

                    // Get the feature index for the co-occurring word.
                    String otherTerm = last.word();
                   
                    // Skip any filtered features.
                    if (otherTerm.equals(EMPTY_STRING))
                        continue;
View Full Code Here

        StringBuilder nullEnd = new StringBuilder(pathLength * 16);
        StringBuilder noNulls = new StringBuilder(pathLength * 16);

        // Iterate over each pair in the path and create the pattern string that
        // represents this path.  The pattern string is pos:rel:pos[,...] .
        DependencyTreeNode first = path.first();
        for (int i = 1; i < pathLength; ++i) {
            DependencyTreeNode second = path.getNode(i);
            // Check that the nodes weren't filtered out.  If so reject the path
            // even if the part of speech and relation text may have matched a
            // template.
            if (first.word().equals(IteratorFactory.EMPTY_TOKEN))
                return false;

            // Get the relation between the two nodes
            String rel = path.getRelation(i - 1);
            String firstPos = first.pos();
            String secPos = second.pos();

            // Check whether each POS has a class category to which it should be
            // mapped.  These classes are necessary to handle the singificant
            // number of variations for a general category of POS's, e.g. verb
            // -> VBZ, VBJ, etc., which were not present when the MINIPAR tags
View Full Code Here

        StringBuilder nullEnd = new StringBuilder(pathLength * 16);
        StringBuilder noNulls = new StringBuilder(pathLength * 16);

        // Iterate over each pair in the path and create the pattern string that
        // represents this path.  The pattern string is pos:rel:pos[,...] .
        DependencyTreeNode first = path.first();
        for (int i = 1; i < pathLength; ++i) {
            DependencyTreeNode second = path.getNode(i);
            // Check that the nodes weren't filtered out.  If so reject the path
            // even if the part of speech and relation text may have matched a
            // template.
            if (first.word().equals(IteratorFactory.EMPTY_TOKEN))
                return false;

            // Get the relation between the two nodes
            String rel = path.getRelation(i - 1);
            String firstPos = first.pos();
            String secPos = second.pos();
           
            nullStart.append((i == 0) ? "(null)" : firstPos);
            nullStart.append(":").append(rel).append(":").append(secPos);

            nullEnd.append(firstPos).append(":").append(rel).append(":");
View Full Code Here

        StringBuilder nullEnd = new StringBuilder(pathLength * 16);
        StringBuilder noNulls = new StringBuilder(pathLength * 16);

        // Iterate over each pair in the path and create the pattern string that
        // represents this path.  The pattern string is pos:rel:pos[,...] .
        DependencyTreeNode first = path.first();
        for (int i = 1; i < pathLength; ++i) {
            DependencyTreeNode second = path.getNode(i);
            // Check that the nodes weren't filtered out.  If so reject the path
            // even if the part of speech and relation text may have matched a
            // template.
            if (first.word().equals(IteratorFactory.EMPTY_TOKEN))
                return false;

            // Get the relation between the two nodes
            String rel = path.getRelation(i - 1);
            String firstPos = first.pos();
            String secPos = second.pos();
           
            nullStart.append((i == 0) ? "(null)" : firstPos);
            nullStart.append(":").append(rel).append(":").append(secPos);

            nullEnd.append(firstPos).append(":").append(rel).append(":");
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public SparseDoubleVector generateContext(DependencyTreeNode[] tree,
                                              int focusIndex) {
        DependencyTreeNode focusNode = tree[focusIndex];

        SparseDoubleVector meaning = new CompactSparseVector(indexVectorLength);

        Iterator<DependencyPath> paths = new FilteredDependencyIterator(
                focusNode, acceptor, pathLength);
View Full Code Here

            if (nodes.length == 0)
                return;

            // Examine the paths for each word in the sentence.
            for (int wordIndex = 0; wordIndex < nodes.length; ++wordIndex) {
                DependencyTreeNode focusNode = nodes[wordIndex];

                // Get the focus word, i.e., the primary key, and the
                // secondary key.  These steps are made as protected methods
                // so that the SenseEvalDependencyContextExtractor
                // PseudoWordDependencyContextExtractor can manage only the
View Full Code Here

            // 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);
View Full Code Here

TOP

Related Classes of edu.ucla.sspace.dependency.DependencyTreeNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.