opennlp.maxent.io
Class OldFormatGISModelReader

java.lang.Object
  extended by opennlp.maxent.io.GISModelReader
      extended by opennlp.maxent.io.PlainTextGISModelReader
          extended by opennlp.maxent.io.OldFormatGISModelReader

public class OldFormatGISModelReader
extends PlainTextGISModelReader

A reader for GIS models stored in the format used in v1.0 of Maxent. It extends the PlainTextGISModelReader to read in the info and then overrides the getParameters method so that it can appropriately read the binary file which stores the parameters.

Version:
$Revision: 1.4 $, $Date: 2005/10/06 11:04:16 $
Author:
Jason Baldridge

Field Summary
 
Fields inherited from class opennlp.maxent.io.GISModelReader
NUM_PREDS
 
Constructor Summary
OldFormatGISModelReader(java.lang.String modelname)
          Constructor which takes the name of the model without any suffixes, such as ".mei.gz" or ".mep.gz".
 
Method Summary
protected  Context[] getParameters(int[][] outcomePatterns)
          Reads the parameters from a file and populates an array of context objects.
static void main(java.lang.String[] args)
          Convert a model created with Maxent 1.0 to a format used with Maxent 1.2.
 
Methods inherited from class opennlp.maxent.io.PlainTextGISModelReader
readDouble, readInt, readUTF
 
Methods inherited from class opennlp.maxent.io.GISModelReader
checkModelType, getCorrectionConstant, getCorrectionParameter, getModel, getOutcomePatterns, getOutcomes, getPredicates
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OldFormatGISModelReader

public OldFormatGISModelReader(java.lang.String modelname)
                        throws java.io.IOException
Constructor which takes the name of the model without any suffixes, such as ".mei.gz" or ".mep.gz".

Throws:
java.io.IOException
Method Detail

getParameters

protected Context[] getParameters(int[][] outcomePatterns)
                           throws java.io.IOException
Reads the parameters from a file and populates an array of context objects.

Overrides:
getParameters in class GISModelReader
Parameters:
outcomePatterns - The outcomes patterns for the model. The first index refers to which outcome pattern (a set of outcomes that occurs with a context) is being specified. The second index specifies the number of contexts which use this pattern at index 0, and the index of each outcomes which make up this pattern in indicies 1-n.
Returns:
An array of context objects.
Throws:
java.io.IOException - when the model file does not match the outcome patterns or can not be read.

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Convert a model created with Maxent 1.0 to a format used with Maxent 1.2.

Usage: java opennlp.maxent.io.OldFormatGISModelReader model_name_prefix (new_model_name)");

If the new_model_name is left unspecified, the new model will be saved in gzipped, binary format as ".bin.gz".

Throws:
java.io.IOException


Copyright © 2005 Jason Baldridge, Gann Bierner, and Thomas Morton. All Rights Reserved.