List of usage examples for edu.stanford.nlp.pipeline StanfordCoreNLP clearAnnotatorPool
public static synchronized void clearAnnotatorPool()
From source file:com.romeikat.datamessie.core.processing.service.stemming.namedEntity.ClassifierPipelineProvider.java
License:Open Source License
@Async public void initializePipeline() { // Perform initialization only once synchronized (pipelineInitializing) { if (pipelineInitializing) { LOG.debug("Skipping classifier pipeline initialization as already in progress"); return; }/* ww w .j ava 2s .co m*/ LOG.info("Starting classifier pipeline initialization"); pipelineInitializing = true; pipeline = null; } // Initialize StanfordCoreNLP.clearAnnotatorPool(); final Properties props = new Properties(); // Lexing props.put("untokenizable", "noneKeep"); // Lemmatization (works only for English) // props.put("annotators", "tokenize, ssplit, pos, lemma"); // Named entity recognition props.put("annotators", "tokenize, ssplit, ner"); props.put("pos.model", posModel); props.put("ner.useSUTime", "false"); props.put("ner.model", nerModel); props.put("ner.applyNumericClassifiers", "false"); try { pipeline = new StanfordCoreNLP(props); } catch (final Exception e) { LOG.error("Could not initialize pipeline", e); return; } // Done LOG.info("Completed classifier pipeline initialization"); pipelineInitializing = false; }