List of usage examples for edu.stanford.nlp.tagger.maxent MaxentTagger MaxentTagger
public MaxentTagger(InputStream modelStream, Properties config, boolean printLoading)
From source file:at.illecker.storm.commons.postagger.GatePOSTagger.java
License:Apache License
private GatePOSTagger() { // Load Stanford POS Tagger with GATE model String taggingModel = Configuration.get("global.resources.postagger.gate.model.path"); LOG.info("Load Stanford POS Tagger with model: " + taggingModel); TaggerConfig posTaggerConf = new TaggerConfig("-model", taggingModel); m_posTagger = new MaxentTagger(taggingModel, posTaggerConf, false); }
From source file:de.tudarmstadt.ukp.dkpro.core.stanfordnlp.StanfordPosTagger.java
License:Open Source License
@Override public void initialize(UimaContext aContext) throws ResourceInitializationException { super.initialize(aContext); modelProvider = new ModelProviderBase<MaxentTagger>() { {/*from ww w . j a va 2s. c o m*/ setContextObject(StanfordPosTagger.this); setDefault(ARTIFACT_ID, "${groupId}.stanfordnlp-model-tagger-${language}-${variant}"); setDefault(LOCATION, "classpath:/${package}/lib/tagger-${language}-${variant}.properties"); setDefaultVariantsLocation("${package}/lib/tagger-default-variants.map"); setOverride(LOCATION, modelLocation); setOverride(LANGUAGE, language); setOverride(VARIANT, variant); } @Override protected MaxentTagger produceResource(URL aUrl) throws IOException { String modelFile = aUrl.toString(); MaxentTagger tagger = new MaxentTagger(modelFile, StringUtils.argsToProperties(new String[] { "-model", modelFile }), false); SingletonTagset tags = new SingletonTagset(POS.class, getResourceMetaData().getProperty(("pos.tagset"))); tags.addAll(tagger.tagSet()); addTagset(tags); if (printTagSet) { getContext().getLogger().log(INFO, getTagset().toString()); } return tagger; } }; posMappingProvider = MappingProviderFactory.createPosMappingProvider(posMappingLocation, language, modelProvider); posMappingProvider.setDefaultVariantsLocation( "de/tudarmstadt/ukp/dkpro/core/stanfordnlp/lib/tagger-default-variants.map"); }
From source file:nl.rug.eco.lucene.EnglishLemmaAnalyzer.java
License:Open Source License
/** * Factory method for loading a POS tagger. */// www . j a v a 2 s. c o m public static MaxentTagger makeTagger(String modelFile) throws Exception { TaggerConfig config = new TaggerConfig("-model", modelFile); // The final argument suppresses a "loading" message on stderr. return new MaxentTagger(modelFile, config, false); }