Package edu.ucla.sspace.dependency

Examples of edu.ucla.sspace.dependency.DependencyPath


        // 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


                // 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") ||
                          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;

                    int featureIndex = termBasis.getDimension(otherTerm);

                    Pair<String> p = new Pair<String>(focusWord, otherTerm);
                    Double curCount = localLemmaCounts.get(p);
                    localLemmaCounts.put(p, (curCount == null)
                            ? 1 : 1 + curCount);

                    // Create a RelationTuple as a local key that records this
                    // relation tuple occurrence.  If there is not a local
                    // relation vector, create it.  Then add an occurrence count
                    // of 1.
                    DependencyRelation relation = path.iterator().next();

                    // Skip relations that do not have the focusWord as the
                    // head word in the relation.  The inverse relation will
                    // eventually be encountered and we'll account for it then.
                    if (!relation.headNode().word().equals(focusWord))
View Full Code Here

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

               
                // 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

        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)
                termVector = permFunc.permute(termVector, path);
            add(meaning, termVector);
        }
        return meaning;
View Full Code Here

                           
                    // 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);
                        matrixEntryToCount.put(new Pair<Integer>(
                                    focusIndex, featureIndex), score);
View Full Code Here

TOP

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

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.