opennlp.maxent.io
Class SuffixSensitiveGISModelReader

java.lang.Object
  extended by opennlp.maxent.io.GISModelReader
      extended by opennlp.maxent.io.SuffixSensitiveGISModelReader
Direct Known Subclasses:
PooledGISModelReader

public class SuffixSensitiveGISModelReader
extends GISModelReader

A reader for GIS models which inspects the filename and invokes the appropriate GISModelReader depending on the filename's suffixes.

The following assumption are made about suffixes:

  • .gz --> the file is gzipped (must be the last suffix)
  • .txt --> the file is plain text
  • .bin --> the file is binary

    Version:
    $Revision: 1.3 $, $Date: 2008/08/22 01:17:04 $
    Author:
    Jason Baldridge

    Field Summary
     
    Fields inherited from class opennlp.maxent.io.GISModelReader
    NUM_PREDS
     
    Constructor Summary
    SuffixSensitiveGISModelReader(java.io.File f)
              Constructor which takes a File and invokes the GISModelReader appropriate for the suffix.
     
    Method Summary
    static void main(java.lang.String[] args)
              To convert between different formats of the new style.
    protected  double readDouble()
              Implement as needed for the format the model is stored in.
    protected  int readInt()
              Implement as needed for the format the model is stored in.
    protected  java.lang.String readUTF()
              Implement as needed for the format the model is stored in.
     
    Methods inherited from class opennlp.maxent.io.GISModelReader
    checkModelType, getCorrectionConstant, getCorrectionParameter, getModel, getOutcomePatterns, getOutcomes, getParameters, getPredicates
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    SuffixSensitiveGISModelReader

    public SuffixSensitiveGISModelReader(java.io.File f)
                                  throws java.io.IOException
    Constructor which takes a File and invokes the GISModelReader appropriate for the suffix.

    Parameters:
    f - The File in which the model is stored.
    Throws:
    java.io.IOException
    Method Detail

    readInt

    protected int readInt()
                   throws java.io.IOException
    Description copied from class: GISModelReader
    Implement as needed for the format the model is stored in.

    Specified by:
    readInt in class GISModelReader
    Throws:
    java.io.IOException

    readDouble

    protected double readDouble()
                         throws java.io.IOException
    Description copied from class: GISModelReader
    Implement as needed for the format the model is stored in.

    Specified by:
    readDouble in class GISModelReader
    Throws:
    java.io.IOException

    readUTF

    protected java.lang.String readUTF()
                                throws java.io.IOException
    Description copied from class: GISModelReader
    Implement as needed for the format the model is stored in.

    Specified by:
    readUTF in class GISModelReader
    Throws:
    java.io.IOException

    main

    public static void main(java.lang.String[] args)
                     throws java.io.IOException
    To convert between different formats of the new style.

    java opennlp.maxent.io.SuffixSensitiveGISModelReader old_model_name new_model_name

    For example, to convert a model called "model.bin.gz" (which is thus saved in gzipped binary format) to one in (unzipped) text format:

    java opennlp.maxent.io.SuffixSensitiveGISModelReader model.bin.gz model.txt

    This particular example would of course be useful when you generally want to create models which take up less space (.bin.gz), but want to be able to inspect a few of them as plain text files.

    Throws:
    java.io.IOException


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