Package opennlp.model

Examples of opennlp.model.BinaryFileDataReader


public class PooledGenericModelSerializer extends GenericModelSerializer {

  @Override
  public AbstractModel create(InputStream in) throws IOException,
      InvalidFormatException {
    return new PooledGenericModelReader(new BinaryFileDataReader(in)).getModel();
  }
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 BinaryGISModelReader(DataInputStream dis) {
    super(new BinaryFileDataReader(dis));
  }
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

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

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

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

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

    return new ParserModel(getLanguage(), getBuildModel(), getCheckModel(), getAttachModel(),
        getParserTaggerModel(), chunkModel, getHeadRules(), getParserType());
  }
 
  private static AbstractModel readModel(String fileName) throws FileNotFoundException, IOException {
    return new GenericModelReader(new BinaryFileDataReader(new FileInputStream(fileName))).
        getModel();
  }
View Full Code Here

TOP

Related Classes of opennlp.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.