Package edu.ucla.sspace.dependency

Examples of edu.ucla.sspace.dependency.FilteredDependencyIterator


                                              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);
           
        // For each of the paths rooted at the focus word, update the
        // co-occurrences of the focus word in the dimension that the
        // BasisFunction states with the weight generated by the
        // DependencyPathWeight function.
        while (paths.hasNext()) {
            DependencyPath path = paths.next();

            // Get the dimension from the basis mapping, ignore any features
            // that are not mapped.
            int dimension = basisMapping.getDimension(path);
                if (dimension < 0)
View Full Code Here


                int focusIndex = termBasis.getDimension(focusWord);

                // Create the path iterator for all acceptable paths rooted at
                // the focus word in the sentence.
                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") ||
View Full Code Here

                SparseDoubleVector focusMeaning = getSemanticVector(focusWord);

                // Get all the valid paths starting from this word.  The
                // acceptor will filter out any paths that don't contain the
                // semantic connections we're looking for.
                Iterator<DependencyPath> paths = new FilteredDependencyIterator(
                            nodes[wordIndex], acceptor, pathLength);
               
                // For each of the paths rooted at the focus word, update the
                // co-occurrences of the focus word in the dimension that the
                // BasisFunction states.
                while (paths.hasNext()) {
                    DependencyPath path = paths.next();

                    // Get the dimension associated with the relation and/or
                    // words in the path from the basis function.  The basis
                    // function creates a specific dimension for the syntactic
                    // context in order to meaningfully comparable vectors.
View Full Code Here

                                              int focusIndex) {
        DependencyTreeNode focusNode = tree[focusIndex];

        SparseDoubleVector meaning = new CompactSparseVector(indexVectorLength);

        Iterator<DependencyPath> paths = new FilteredDependencyIterator(
                focusNode, acceptor, pathLength);

        while (paths.hasNext()) {
            DependencyPath path = paths.next();
            if (readOnly && !indexMap.containsKey(path.last().word()))
                continue;

            TernaryVector termVector = indexMap.get(path.last().word());
            if (permFunc != null)
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public SparseDoubleVector generateContext(DependencyTreeNode[] tree,
                                              int focusIndex) {
        Iterator<DependencyPath> paths = new FilteredDependencyIterator(
                tree[focusIndex], acceptor, 1);

        // Get the first contextualized meaning.  Return any empty vector in
        // case we don't have any paths for the word of interest (this should
        // never happen).
        if (!paths.hasNext())
            return new CompactSparseVector();
        SparseDoubleVector focusMeaning = contextualize(paths.next());

        // If this focus word isn't connected to any other word, just return the
        // contextualized vector that we have.
        if (!paths.hasNext())
            return focusMeaning;
        SparseDoubleVector secondMeaning = contextualize(paths.next());

        // If we have two relations for the focus word, multiply each
        // contextualized vector from the relations and return that as the final
        // meaning.
        return VectorMath.multiplyUnmodified(focusMeaning, secondMeaning);
View Full Code Here

                    // Get all the valid paths starting from this word.    The
                    // acceptor will filter out any paths that don't contain the
                    // semantic connections we're looking for.
                    Iterator<DependencyPath> paths =
                        new FilteredDependencyIterator(
                                nodes[wordIndex], acceptor, pathLength);
                           
                    // For each of the paths rooted at the focus word, update
                    // the co-occurrences of the focus word in the dimension
                    // that the BasisFunction states.
                    while (paths.hasNext()) {
                        DependencyPath path = paths.next();

                        String occurrence = path.last().word();
                        int featureIndex = basis.getDimension(occurrence);

                        double score = weighter.scorePath(path);
View Full Code Here

TOP

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

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.