Search in sources :

Example 1 with TokenizerModelResource

use of opennlp.uima.tokenize.TokenizerModelResource in project deeplearning4j by deeplearning4j.

the class ConcurrentTokenizer method initialize.

/**
     * Initializes the current instance with the given context.
     *
     * Note: Do all initialization in this method, do not use the constructor.
     */
public void initialize(UimaContext context) throws ResourceInitializationException {
    super.initialize(context);
    TokenizerModel model;
    try {
        TokenizerModelResource modelResource = (TokenizerModelResource) context.getResourceObject(UimaUtil.MODEL_PARAMETER);
        model = modelResource.getModel();
    } catch (ResourceAccessException e) {
        throw new ResourceInitializationException(e);
    }
    tokenizer = new TokenizerME(model);
}
Also used : ResourceInitializationException(org.apache.uima.resource.ResourceInitializationException) TokenizerModelResource(opennlp.uima.tokenize.TokenizerModelResource) TokenizerME(opennlp.tools.tokenize.TokenizerME) TokenizerModel(opennlp.tools.tokenize.TokenizerModel) ResourceAccessException(org.apache.uima.resource.ResourceAccessException)

Aggregations

TokenizerME (opennlp.tools.tokenize.TokenizerME)1 TokenizerModel (opennlp.tools.tokenize.TokenizerModel)1 TokenizerModelResource (opennlp.uima.tokenize.TokenizerModelResource)1 ResourceAccessException (org.apache.uima.resource.ResourceAccessException)1 ResourceInitializationException (org.apache.uima.resource.ResourceInitializationException)1