Examples of GrammaticalRelationTag


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

        Token visited = sentence.addToken(visitedStartIdx, visitedStartIdx + "visited".length());
       
        int chinaStartIdx = sentence.getSpan().toString().indexOf("China");
        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)));
View Full Code Here

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

    @Override
    public ObjectNode serialize(ObjectMapper mapper, DependencyRelation relation) {
        ObjectNode jDependencyRelation = mapper.createObjectNode();

        GrammaticalRelationTag gramRelTag = relation.getGrammaticalRelationTag();
        jDependencyRelation.put(RELATION_TYPE_TAG, gramRelTag.getTag());
        jDependencyRelation.put(RELATION_STANBOL_TYPE_TAG, gramRelTag.getGrammaticalRelation().ordinal());
        jDependencyRelation.put(RELATION_IS_DEPENDENT_TAG, (relation.isDependent()));

        Span partner = relation.getPartner();
        if (partner != null) {
            jDependencyRelation.put(RELATION_PARTNER_TYPE_TAG, partner.getType().toString());
View Full Code Here

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

                                            + jDependencyRelation + ")");
        }

        GrammaticalRelation grammaticalRelation = GrammaticalRelation.class.getEnumConstants()[jDependencyRelation
                .path(RELATION_STANBOL_TYPE_TAG).asInt()];
        GrammaticalRelationTag gramRelTag = new GrammaticalRelationTag(tag.getTextValue(),
                grammaticalRelation);

        JsonNode isDependent = jDependencyRelation.path(RELATION_IS_DEPENDENT_TAG);

        if (!isDependent.isBoolean()) {
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.