opennlp.tools.postag.POSTaggerFactory Java Examples

The following examples show how to use opennlp.tools.postag.POSTaggerFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OpenNlpPosRecommender.java    From inception with Apache License 2.0 6 votes vote down vote up
@Nullable
private POSModel train(List<POSSample> aPosSamples, TrainingParameters aParameters)
    throws RecommendationException
{
    if (aPosSamples.isEmpty()) {
        return null;
    }

    try (POSSampleStream stream = new POSSampleStream(aPosSamples)) {
        POSTaggerFactory taggerFactory = new POSTaggerFactory();
        return POSTaggerME.train("unknown", stream, aParameters, taggerFactory);
    }
    catch (IOException e) {
        throw new RecommendationException("Error training model", e);
    }
}
 
Example #2
Source File: POSCrossValidator.java    From ixa-pipe-pos with Apache License 2.0 5 votes vote down vote up
private void createPOSFactory(final TrainingParameters params) {
  final String featureSet = Flags.getFeatureSet(params);
  if (featureSet.equalsIgnoreCase("Opennlp")) {
    this.posTaggerFactory = new POSTaggerFactory();
  } else {
    this.posTaggerFactory = new BaselineFactory();
  }
}
 
Example #3
Source File: AbstractTaggerTrainer.java    From ixa-pipe-pos with Apache License 2.0 2 votes vote down vote up
/**
 * Get the posTaggerFactory. Every extension of this class must provide an
 * implementation of the posTaggerFactory.
 * 
 * @return the posTaggerFactory
 */
protected final POSTaggerFactory getPosTaggerFactory() {
  return this.posTaggerFactory;
}
 
Example #4
Source File: AbstractTaggerTrainer.java    From ixa-pipe-pos with Apache License 2.0 2 votes vote down vote up
/**
 * Set/implement the posTaggerFactory to be used in the pos tagger training.
 * 
 * @param aPosTaggerFactory
 *          the pos tagger factory implemented
 */
protected final void setPosTaggerFactory(
    final POSTaggerFactory aPosTaggerFactory) {
  this.posTaggerFactory = aPosTaggerFactory;
}