Package opennlp.model

Examples of opennlp.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(model, new DataOutputStream(new OutputStream() {
      @Override
      public void write(int b) throws IOException {
        out.write(b);
      }
    }));
    modelWriter.persist();
  }
View Full Code Here


      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(model, new DataOutputStream(new OutputStream() {
      @Override
      public void write(int b) throws IOException {
        out.write(b);
      }
    }));
    modelWriter.persist();
  }
View Full Code Here

      // when
     // QNModel trainedModel = new QNTrainer(5, 500, true).trainModel(new TwoPassDataIndexer(createTrainingStream()));
      QNModel trainedModel = new QNTrainer(5, 700, true).trainModel(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.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.