/** * Get the given structure classes from by name or return all classes if null or empty * * @param typeNames the types to get * @return the structure classes * @throws ResourceInitializationException */ public static Set<Class<? extends Structure>> getStructureClasses(String... typeNames) throws ResourceInitializationException { return TypeUtils.getTypeClasses(Structure.class, typeNames); }
/** * Gets the value of key * * @param key the key * @return the optional of the value */ public Optional<String> get(final String key) { return metadata.find(key); }
/** * Build the covering 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 structuralClasses the structural classes * @return the StructureHierachy */ public static CoveringStructureHierarchy build( JCas jCas, Set<Class<? extends Structure>> structuralClasses) { Node<Structure> root = StructureHierarchy.build(jCas, structuralClasses).getRoot(); Map<Annotation, Collection<Structure>> covering = buildCovering(jCas, structuralClasses); return new CoveringStructureHierarchy(root, covering); }
/** * Creates the referent map - map of referent target to entities. * * @param <T> the generic type * @param jCas the j cas * @param clazz the clazz * @return the multimap */ public static <T extends Base> Multimap<ReferenceTarget, T> createReferentMap( final JCas jCas, final Class<T> clazz) { return createReferentMap(jCas, clazz, true); }
/** * Get all the structure classes * * @return the structure classes * @throws ResourceInitializationException */ public static Set<Class<? extends Structure>> getStructureClasses() throws ResourceInitializationException { return getStructureClasses((String[]) null); }
/** * Instantiates a new job settings. * * @param jCas the jcas */ public JobSettings(final JCas jCas) { this.jCas = jCas; metadata = new JCasMetadata(jCas); }
/** * Recursively build the structure hierarchy * * @param deque the deque of nodes * @param s the current annotation */ private static <T extends Annotation> void build(Deque<AnnotationNode<T>> deque, T s) { final AnnotationNode<T> parent = getParent(deque, s); final AnnotationNode<T> node = new AnnotationNode<>(parent, s); parent.addChild(node); deque.push(node); }
/** * 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 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 structuralClasses the structural classes * @return the StructureHierachy */ public static CoveringStructureHierarchy build( JCas jCas, Set<Class<? extends Structure>> structuralClasses) { Node<Structure> root = StructureHierarchy.build(jCas, structuralClasses).getRoot(); Map<Annotation, Collection<Structure>> covering = buildCovering(jCas, structuralClasses); return new CoveringStructureHierarchy(root, covering); }
/** * Creates the referent map - map of referent target to entities. * * @param <T> the generic type * @param jCas the j cas * @param clazz the clazz * @return the multimap */ public static <T extends Base> Multimap<ReferenceTarget, T> createReferentMap( final JCas jCas, final Class<T> clazz) { return createReferentMap(jCas, clazz, true); }
/** * Get the given structure classes from by name or return all classes if null or empty * * @param typeNames the types to get * @return the structure classes * @throws ResourceInitializationException */ public static Set<Class<? extends Structure>> getStructureClasses(String... typeNames) throws ResourceInitializationException { return TypeUtils.getTypeClasses(Structure.class, typeNames); }
/** * Gets the value of key * * @param key the key * @return the optional of the value */ public Optional<String> get(final String key) { return metadata.find(key); }
/** * Get all the structure classes * * @return the structure classes * @throws ResourceInitializationException */ public static Set<Class<? extends Structure>> getStructureClasses() throws ResourceInitializationException { return getStructureClasses((String[]) null); }
/** * Instantiates a new job settings. * * @param jCas the jcas */ public JobSettings(final JCas jCas) { this.jCas = jCas; metadata = new JCasMetadata(jCas); }
/** * Recursively build the structure hierarchy * * @param deque the deque of nodes * @param s the current annotation */ private static <T extends Annotation> void build(Deque<AnnotationNode<T>> deque, T s) { final AnnotationNode<T> parent = getParent(deque, s); final AnnotationNode<T> node = new AnnotationNode<>(parent, s); parent.addChild(node); deque.push(node); }
/** * 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)); }