Example usage for opennlp.tools.namefind TokenNameFinderModel serialize

List of usage examples for opennlp.tools.namefind TokenNameFinderModel serialize

Introduction

In this page you can find the example usage for opennlp.tools.namefind TokenNameFinderModel serialize.

Prototype

@SuppressWarnings("unchecked")
public final void serialize(OutputStream out) throws IOException 

Source Link

Document

Serializes the model to the given OutputStream .

Usage

From source file:de.tudarmstadt.ukp.dkpro.core.opennlp.OpenNlpNamedEntityRecognizerTrainer.java

@Override
public void collectionProcessComplete() throws AnalysisEngineProcessException {
    try {/* w w w. j av a  2  s.  c  o m*/
        stream.close();
    } catch (IOException e) {
        throw new AnalysisEngineProcessException(e);
    }

    TokenNameFinderModel model;
    try {
        model = future.get();
    } catch (InterruptedException | ExecutionException e) {
        throw new AnalysisEngineProcessException(e);
    }

    try (OutputStream out = new FileOutputStream(targetLocation)) {
        model.serialize(out);
    } catch (IOException e) {
        throw new AnalysisEngineProcessException(e);
    }
}