opennlp.perceptron
Class PlainTextPerceptronModelWriter

java.lang.Object
  extended by opennlp.model.AbstractModelWriter
      extended by opennlp.perceptron.PerceptronModelWriter
          extended by opennlp.perceptron.PlainTextPerceptronModelWriter

public class PlainTextPerceptronModelWriter
extends PerceptronModelWriter

Model writer that saves models in plain text format.


Constructor Summary
PlainTextPerceptronModelWriter(AbstractModel model, java.io.BufferedWriter bw)
          Constructor which takes a PerceptronModel and a BufferedWriter and prepares itself to write the model to that writer.
PlainTextPerceptronModelWriter(AbstractModel model, java.io.File f)
          Constructor which takes a PerceptronModel and a File and prepares itself to write the model to that file.
 
Method Summary
 void close()
           
 void writeDouble(double d)
           
 void writeInt(int i)
           
 void writeUTF(java.lang.String s)
           
 
Methods inherited from class opennlp.perceptron.PerceptronModelWriter
persist
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlainTextPerceptronModelWriter

public PlainTextPerceptronModelWriter(AbstractModel model,
                                      java.io.File f)
                               throws java.io.IOException,
                                      java.io.FileNotFoundException
Constructor which takes a PerceptronModel and a File and prepares itself to write the model to that file. Detects whether the file is gzipped or not based on whether the suffix contains ".gz".

Parameters:
model - The PerceptronModel which is to be persisted.
f - The File in which the model is to be persisted.
Throws:
java.io.IOException
java.io.FileNotFoundException

PlainTextPerceptronModelWriter

public PlainTextPerceptronModelWriter(AbstractModel model,
                                      java.io.BufferedWriter bw)
Constructor which takes a PerceptronModel and a BufferedWriter and prepares itself to write the model to that writer.

Parameters:
model - The PerceptronModel which is to be persisted.
bw - The BufferedWriter which will be used to persist the model.
Method Detail

writeUTF

public void writeUTF(java.lang.String s)
              throws java.io.IOException
Specified by:
writeUTF in class AbstractModelWriter
Throws:
java.io.IOException

writeInt

public void writeInt(int i)
              throws java.io.IOException
Specified by:
writeInt in class AbstractModelWriter
Throws:
java.io.IOException

writeDouble

public void writeDouble(double d)
                 throws java.io.IOException
Specified by:
writeDouble in class AbstractModelWriter
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Specified by:
close in class AbstractModelWriter
Throws:
java.io.IOException


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.