@Override public ObjectNode serialize(ObjectMapper mapper, CorefFeature coref) { ObjectNode jCoref = mapper.createObjectNode(); jCoref.put(IS_REPRESENTATIVE_TAG, coref.isRepresentative()); Set<Span> mentions = coref.getMentions(); ArrayNode jMentions = mapper.createArrayNode(); for(Span mention : mentions) { ObjectNode jMention = mapper.createObjectNode(); jMention.put(MENTION_TYPE_TAG, mention.getType().toString()); jMention.put(MENTION_START_TAG, mention.getStart()); jMention.put(MENTION_END_TAG, mention.getEnd()); jMentions.add(jMention); } jCoref.put(MENTIONS_TAG, jMentions); return jCoref; }
@Override public ObjectNode serialize(ObjectMapper mapper, CorefFeature coref) { ObjectNode jCoref = mapper.createObjectNode(); jCoref.put(IS_REPRESENTATIVE_TAG, coref.isRepresentative()); Set<Span> mentions = coref.getMentions(); ArrayNode jMentions = mapper.createArrayNode(); for(Span mention : mentions) { ObjectNode jMention = mapper.createObjectNode(); jMention.put(MENTION_TYPE_TAG, mention.getType().toString()); jMention.put(MENTION_START_TAG, mention.getStart()); jMention.put(MENTION_END_TAG, mention.getEnd()); jMentions.add(jMention); } jCoref.put(MENTIONS_TAG, jMentions); return jCoref; }
@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()); jDependencyRelation.put(RELATION_PARTNER_START_TAG, partner.getStart()); jDependencyRelation.put(RELATION_PARTNER_END_TAG, partner.getEnd()); } else { jDependencyRelation.put(RELATION_PARTNER_TYPE_TAG, ROOT_TAG); jDependencyRelation.put(RELATION_PARTNER_START_TAG, 0); jDependencyRelation.put(RELATION_PARTNER_END_TAG, 0); } return jDependencyRelation; }
@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()); jDependencyRelation.put(RELATION_PARTNER_START_TAG, partner.getStart()); jDependencyRelation.put(RELATION_PARTNER_END_TAG, partner.getEnd()); } else { jDependencyRelation.put(RELATION_PARTNER_TYPE_TAG, ROOT_TAG); jDependencyRelation.put(RELATION_PARTNER_START_TAG, 0); jDependencyRelation.put(RELATION_PARTNER_END_TAG, 0); } return jDependencyRelation; }