public Term newTerm(Span<WF> span, boolean isComponent) { String newId = idManager.getNextId(AnnotationType.TERM); Term newTerm = new Term(newId, span, isComponent); if (!isComponent) { annotationContainer.add(newTerm, Layer.TERMS, AnnotationType.TERM); } addToWfTermIndex(newTerm.getSpan().getTargets(), newTerm); // Rodrirekin hitz egin hau kentzeko return newTerm; }
public Term newTerm(String id, Span<WF> span, Integer position) { idManager.updateCounter(AnnotationType.TERM, id); Term newTerm = new Term(id, span, false); annotationContainer.add(newTerm, Layer.TERMS, AnnotationType.TERM, position); addToWfTermIndex(newTerm.getSpan().getTargets(), newTerm); // Rodrirekin hitz egin hau kentzeko return newTerm; }
/** Creates an Entity object to load an existing entity. It receives the ID as an argument. The entity is added to the document object. * @param id the ID of the named entity. * @param type entity type. 8 values are posible: Person, Organization, Location, Date, Time, Money, Percent, Misc. * @param references it contains one or more span elements. A span can be used to reference the different occurrences of the same named entity in the document. If the entity is composed by multiple words, multiple target elements are used. * @return a new named entity. */ public Entity newEntity(String id, List<Span<Term>> references) { idManager.updateCounter(AnnotationType.ENTITY, id); Entity newEntity = new Entity(id, references); annotationContainer.add(newEntity, Layer.ENTITIES, AnnotationType.ENTITY); return newEntity; }
/** Creates a new opinion object. It assigns an appropriate ID to it. The opinion is added to the document. * @return a new opinion. */ public Opinion newOpinion() { String newId = idManager.getNextId(AnnotationType.OPINION); Opinion newOpinion = new Opinion(newId); annotationContainer.add(newOpinion, Layer.OPINIONS, AnnotationType.OPINION); return newOpinion; }
/** Creates a new srl predicate. It assigns an appropriate ID to it. The predicate is added to the document. * @param span span containing all the targets of the predicate * @return a new predicate */ public Predicate newPredicate(Span<Term> span) { String newId = idManager.getNextId(AnnotationType.PREDICATE); Predicate newPredicate = new Predicate(newId, span); annotationContainer.add(newPredicate, Layer.SRL, AnnotationType.PREDICATE); return newPredicate; }
public void addExistingAnnotation(Annotation ann, Layer layer, AnnotationType type) { if (isIdentifiableAnnotationType(type)) { String newId = idManager.getNextId(type); ((IdentifiableAnnotation) ann).setId(newId); } annotationContainer.add(ann, layer, type); }
/** Creates a new coreference. It assigns an appropriate ID to it. The Coref is added to the document. * @param references different mentions (list of targets) to the same entity. * @return a new coreference. */ public Coref newCoref(List<Span<Term>> mentions) { String newId = idManager.getNextId(AnnotationType.COREF); Coref newCoref = new Coref(newId, mentions); annotationContainer.add(newCoref, Layer.COREFERENCES, AnnotationType.COREF); return newCoref; }
/** Creates a new relation between entities and/or sentiment features. It assigns an appropriate ID to it. The relation is added to the document. * @param from source of the relation * @param to target of the relation * @return a new relation */ public Relation newRelation(Relational from, Relational to) { String newId = idManager.getNextId(AnnotationType.RELATION); Relation newRelation = new Relation(newId, from, to); annotationContainer.add(newRelation, Layer.RELATIONS, AnnotationType.RELATION); return newRelation; }
/** * Creates a LinkedEntity object and add it to the document * * @param term the Term of the coreference. * @return a new factuality. */ public LinkedEntity newLinkedEntity(Span<WF> span) { String newId = idManager.linkedentities.getNext(); LinkedEntity linkedEntity = new LinkedEntity(newId, span); annotationContainer.add(linkedEntity); return linkedEntity; }
public Statement newStatement(String id, Statement.StatementTarget target) { idManager.updateCounter(AnnotationType.STATEMENT, id); Statement newStatement = new Statement(id, target); annotationContainer.add(newStatement, Layer.ATTRIBUTION, AnnotationType.STATEMENT); return newStatement; }