List of usage examples for opennlp.tools.chunker ChunkerModel ChunkerModel
public ChunkerModel(URL modelURL) throws IOException, InvalidFormatException
From source file:hrpod.tools.nlp.NLPTools.java
public void setChunkerModel() { try {/*from w w w . j ava 2 s. c o m*/ URL chUrl = this.getClass().getResource(modelBasePath + "en-chunker.bin"); this.chunkerModel = new ChunkerModel(new FileInputStream(new File(chUrl.getFile()))); } catch (Exception e) { logger.error("Error is setChunkerModel", e); } }
From source file:org.dbpedia.spotlight.spot.OpenNLPUtil.java
protected static BaseModel loadgivenmodeltype(OpenNlpModels m, InputStream in) throws InvalidFormatException, IOException { BaseModel mdl = null;//from w w w .jav a 2 s . com switch (m) { case TokenizerModel: { mdl = new TokenizerModel(in); LOG.debug("OpenNLP5 Tokenizer Model loaded: " + mdl); break; } case POSModel: { mdl = new POSModel(in); LOG.debug("OpenNLP5 POS Model loaded: " + mdl); break; } case SentenceModel: { mdl = new SentenceModel(in); LOG.debug("OpenNLP5 Sentence Model loaded: " + mdl); break; } case ChunkModel: { mdl = new ChunkerModel(in); LOG.debug("OpenNLP5 Sentence Model loaded: " + mdl); break; } case person: case organization: case location: { mdl = new TokenNameFinderModel(in); LOG.debug("OpenNLP5 TokenNameFinderModel Model loaded: " + mdl); break; } default: LOG.debug("Unknown Model Type!"); } return mdl; }