/** * Construct the default annotator pool from the passed in properties, and overwriting annotators which have changed * since the last call. * * @param inputProps Properties to determine behavior of annotators * @param annotatorImplementation Source of annotator implementations * @return A populated AnnotatorPool */ private static AnnotatorPool constructAnnotatorPool(final Properties inputProps, final AnnotatorImplementations annotatorImplementation) { AnnotatorPool pool = new AnnotatorPool(); for (Map.Entry<String, BiFunction<Properties, AnnotatorImplementations, Annotator>> entry : getNamedAnnotators().entrySet()) { AnnotatorSignature key = new AnnotatorSignature(entry.getKey(), PropertiesUtils.getSignature(entry.getKey(), inputProps)); pool.register(entry.getKey(), inputProps, GLOBAL_ANNOTATOR_CACHE.computeIfAbsent(key, (sig) -> Lazy.cache(() -> entry.getValue().apply(inputProps, annotatorImplementation)))); } registerCustomAnnotators(pool, annotatorImplementation, inputProps); return pool; }
/** * Construct the default annotator pool from the passed in properties, and overwriting annotators which have changed * since the last call. * * @param inputProps Properties to determine behavior of annotators * @param annotatorImplementation Source of annotator implementations * @return A populated AnnotatorPool */ private static AnnotatorPool constructAnnotatorPool(final Properties inputProps, final AnnotatorImplementations annotatorImplementation) { AnnotatorPool pool = new AnnotatorPool(); for (Map.Entry<String, BiFunction<Properties, AnnotatorImplementations, Annotator>> entry : getNamedAnnotators().entrySet()) { AnnotatorSignature key = new AnnotatorSignature(entry.getKey(), PropertiesUtils.getSignature(entry.getKey(), inputProps)); pool.register(entry.getKey(), inputProps, GLOBAL_ANNOTATOR_CACHE.computeIfAbsent(key, (sig) -> Lazy.cache(() -> entry.getValue().apply(inputProps, annotatorImplementation)))); } registerCustomAnnotators(pool, annotatorImplementation, inputProps); return pool; }
pool = new AnnotatorPool();
pool = new AnnotatorPool();