Examples of DependencyRelation


Examples of edu.ucla.sspace.dependency.DependencyRelation

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

                    RelationTuple relationKey = new RelationTuple(
                            focusIndex, relation.relation().intern());
                    SparseDoubleVector relationVector = localTuples.get(
                            relationKey);
                    if (relationVector == null) {
                        relationVector = new CompactSparseVector();
                        localTuples.put(relationKey, relationVector);
View Full Code Here

Examples of edu.ucla.sspace.dependency.DependencyRelation

        // meaning.
        return VectorMath.multiplyUnmodified(focusMeaning, secondMeaning);
    }

    private SparseDoubleVector contextualize(DependencyPath path) {
        DependencyRelation rel = path.iterator().next();
        String relation = rel.relation();
        String focusTerm = path.first().word();
        String otherTerm = path.last().word();

        // Skip any filtered features.
        if (otherTerm.equals(EMPTY_STRING))
            return null;
        boolean isFocusHead = !rel.headNode().word().equals(focusTerm);
        return svs.contextualize(focusTerm, relation, otherTerm, isFocusHead);
    }
View Full Code Here

Examples of org.apache.stanbol.enhancer.nlp.dependency.DependencyRelation

        Token china = sentence.addToken(chinaStartIdx, chinaStartIdx + "China".length());
       
        GrammaticalRelationTag nSubjGrammRelTag = new GrammaticalRelationTag(
                "nsubj", GrammaticalRelation.NominalSubject);
        obama.addAnnotation(NlpAnnotations.DEPENDENCY_ANNOTATION,
          Value.value(new DependencyRelation(nSubjGrammRelTag, true, visited)));
       
        GrammaticalRelationTag rootGrammRelTag = new GrammaticalRelationTag(
                "root", GrammaticalRelation.Root);
        GrammaticalRelationTag dobjGrammRelTag = new GrammaticalRelationTag(
                "dobj", GrammaticalRelation.DirectObject);
        visited.addAnnotation(NlpAnnotations.DEPENDENCY_ANNOTATION,
          Value.value(new DependencyRelation(rootGrammRelTag, true, null)));
        visited.addAnnotation(NlpAnnotations.DEPENDENCY_ANNOTATION,
            Value.value(new DependencyRelation(nSubjGrammRelTag, false, obama)));
        visited.addAnnotation(NlpAnnotations.DEPENDENCY_ANNOTATION,
            Value.value(new DependencyRelation(dobjGrammRelTag, false, china)));
       
        china.addAnnotation(NlpAnnotations.DEPENDENCY_ANNOTATION,
            Value.value(new DependencyRelation(dobjGrammRelTag, true, visited)));
  }
View Full Code Here

Examples of org.apache.stanbol.enhancer.nlp.dependency.DependencyRelation

                    partnerSpan = at.addToken(spanStart, spanEnd);
                    break;
            }
        }

        return new DependencyRelation(gramRelTag, isDependent.asBoolean(), partnerSpan);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.