Package opennlp.tools.ml.model

Examples of opennlp.tools.ml.model.GenericModelWriter


      throw new IllegalArgumentException("model parameter must not be null!");

    if (out == null)
      throw new IllegalArgumentException("out parameter must not be null!");

    GenericModelWriter modelWriter = new GenericModelWriter((AbstractModel) model, new DataOutputStream(new OutputStream() {
      @Override
      public void write(int b) throws IOException {
        out.write(b);
      }
    }));
    modelWriter.persist();
  }
View Full Code Here


      DataIndexer testDataIndexer = new OnePassRealValueDataIndexer(rvfes1,1);
      // when
      QNModel trainedModel = new QNTrainer(5, 700, true).trainModel(ITERATIONS, testDataIndexer);
     
      ByteArrayOutputStream modelBytes = new ByteArrayOutputStream();
      GenericModelWriter modelWriter = new GenericModelWriter(trainedModel,
          new DataOutputStream(modelBytes));
      modelWriter.persist();
      modelWriter.close();
     
      GenericModelReader modelReader = new GenericModelReader(new BinaryFileDataReader(
          new ByteArrayInputStream(modelBytes.toByteArray())));
      AbstractModel readModel = modelReader.getModel();
      QNModel deserModel = (QNModel) readModel;
View Full Code Here

TOP

Related Classes of opennlp.tools.ml.model.GenericModelWriter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.