Package opennlp.tools.ml.model

Examples of opennlp.tools.ml.model.BinaryFileDataReader


public class GenericModelSerializer implements ArtifactSerializer<AbstractModel> {

  public AbstractModel create(InputStream in) throws IOException,
      InvalidFormatException {
    return new GenericModelReader(new BinaryFileDataReader(in)).getModel();
  }
View Full Code Here


    String lang = args[1];
    String packageName = args[2];
    String modelName = args[3];

    AbstractModel chunkerModel = new GenericModelReader(
        new BinaryFileDataReader(new FileInputStream(modelName))).getModel();

    ChunkerModel packageModel = new ChunkerModel(lang, chunkerModel);
    packageModel.serialize(new FileOutputStream(packageName));
  }
View Full Code Here

   * the model contents.
   *
   * @param dis The DataInputStream containing the model information.
   */
  public BinaryPerceptronModelReader(DataInputStream dis) {
    super(new BinaryFileDataReader(dis));
  }
View Full Code Here

   *
   * @param dis
   *          The DataInputStream containing the model information.
   */
  public BinaryQNModelReader(DataInputStream dis) {
    super(new BinaryFileDataReader(dis));
  }
View Full Code Here

   *
   * @param dis
   *          The DataInputStream containing the model information.
   */
  public BinaryGISModelReader(DataInputStream dis) {
    super(new BinaryFileDataReader(dis));
  }
View Full Code Here

      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;
     
      assertTrue(trainedModel.equals(deserModel));
View Full Code Here

TOP

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

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.