/** * Build the structure hierarchy, by first collecting all the annotations. * * @param jCas the jCas * @param annotationTypes the annotations classes to use * @return the root structure node */ protected static <T extends Annotation> Node<T> buildRoot( JCas jCas, Set<Class<? extends T>> annotationTypes) { return build( TypeUtils.filterAnnotations( JCasUtil.select(jCas, BaleenAnnotation.class), annotationTypes)); }
/** * Build the structure hierarchy, by first collecting all the annotations. * * @param jCas the jCas * @param annotationTypes the annotations classes to use * @return the root structure node */ protected static <T extends Annotation> Node<T> buildRoot( JCas jCas, Set<Class<? extends T>> annotationTypes) { return build( TypeUtils.filterAnnotations( JCasUtil.select(jCas, BaleenAnnotation.class), annotationTypes)); }
/** * Build the covering index of baleen annotations by structure annotations (lazily) filtered to * only the given structural classes * * @param jCas the jCas * @param structuralClasses the structural classes * @return the covering index */ private static Map<Annotation, Collection<Structure>> buildCovering( JCas jCas, Set<Class<? extends Structure>> structuralClasses) { return Maps.transformValues( JCasUtil.indexCovering(jCas, BaleenAnnotation.class, Structure.class), s -> TypeUtils.filterAnnotations(s, structuralClasses)); } }
/** * Build the covering index of baleen annotations by structure annotations (lazily) filtered to * only the given structural classes * * @param jCas the jCas * @param structuralClasses the structural classes * @return the covering index */ private static Map<Annotation, Collection<Structure>> buildCovering( JCas jCas, Set<Class<? extends Structure>> structuralClasses) { return Maps.transformValues( JCasUtil.indexCovering(jCas, BaleenAnnotation.class, Structure.class), s -> TypeUtils.filterAnnotations(s, structuralClasses)); } }
/** * Build the structure hierarchy for the given jCas, using only the structural classes provided. * * <p>The structure is built by first using the offset of the Structure annotation and then using * the depth. * * @param jCas the jCas * @param types the structural classes * @return the Structure base AnnotationHierachy */ public static StructureHierarchy build(JCas jCas, Set<Class<? extends Structure>> types) { final List<Structure> structures = filterAnnotations(JCasUtil.select(jCas, Structure.class), types); return new StructureHierarchy(AnnotationHierarchyBuilder.build(structures)); } }
/** * Build the structure hierarchy for the given jCas, using only the structural classes provided. * * <p>The structure is built by first using the offset of the Structure annotation and then using * the depth. * * @param jCas the jCas * @param types the structural classes * @return the Structure base AnnotationHierachy */ public static StructureHierarchy build(JCas jCas, Set<Class<? extends Structure>> types) { final List<Structure> structures = filterAnnotations(JCasUtil.select(jCas, Structure.class), types); return new StructureHierarchy(AnnotationHierarchyBuilder.build(structures)); } }
TypeUtils.filterAnnotations(JCasUtil.select(jCas, Entity.class), options.getTypeClasses());
TypeUtils.filterAnnotations(JCasUtil.select(jCas, Entity.class), options.getTypeClasses());