Package opennlp.tools.ml.naivebayes
Class PlainTextNaiveBayesModelWriter
- java.lang.Object
-
- opennlp.tools.ml.model.AbstractModelWriter
-
- opennlp.tools.ml.naivebayes.NaiveBayesModelWriter
-
- opennlp.tools.ml.naivebayes.PlainTextNaiveBayesModelWriter
-
public class PlainTextNaiveBayesModelWriter extends NaiveBayesModelWriter
ANaiveBayesModelWriterthat writes models in a plain text format.
-
-
Constructor Summary
Constructors Constructor Description PlainTextNaiveBayesModelWriter(AbstractModel model, BufferedWriter bw)PlainTextNaiveBayesModelWriter(AbstractModel model, File f)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the underlyingDataOutputStream.voidwriteDouble(double d)Writes a singledoubleto the underlyingDataOutputStream.voidwriteInt(int i)Writes a singleintto the underlyingDataOutputStream.voidwriteUTF(String s)Writes aStringto the underlyingDataOutputStream.-
Methods inherited from class opennlp.tools.ml.naivebayes.NaiveBayesModelWriter
persist
-
-
-
-
Constructor Detail
-
PlainTextNaiveBayesModelWriter
public PlainTextNaiveBayesModelWriter(AbstractModel model, File f) throws IOException
InstantiatesPlainTextNaiveBayesModelWritervia annaive bayes modeland aFile. Prepares writing of amodelto the file. Based on whether the file's suffix contains.gz, it detects whether the file is gzipped or not.- Parameters:
model- Thenaive bayes modelwhich is to be persisted.f- TheFilein which the model is to be persisted.- Throws:
IOException- Thrown if IO errors occurred.- See Also:
NaiveBayesModel
-
PlainTextNaiveBayesModelWriter
public PlainTextNaiveBayesModelWriter(AbstractModel model, BufferedWriter bw)
InstantiatesPlainTextNaiveBayesModelWritervia annaive bayes modeland aBufferedWriter. Prepares writing amodelto the file. Based on whether the file's suffix contains.gz, it detects whether the file is gzipped or not.- Parameters:
model- Thenaive bayes modelwhich is to be persisted.bw- TheBufferedWriterwhich is used to persist themodel. Thebwmust be opened.
-
-
Method Detail
-
writeUTF
public void writeUTF(String s) throws IOException
Description copied from class:AbstractModelWriterWrites aStringto the underlyingDataOutputStream.- Specified by:
writeUTFin classAbstractModelWriter- Parameters:
s- TheUTF encodedcharacters.- Throws:
IOException- Thrown if IO errors occurred.
-
writeInt
public void writeInt(int i) throws IOExceptionDescription copied from class:AbstractModelWriterWrites a singleintto the underlyingDataOutputStream.- Specified by:
writeIntin classAbstractModelWriter- Parameters:
i- Theintvalue.- Throws:
IOException- Thrown if IO errors occurred.
-
writeDouble
public void writeDouble(double d) throws IOExceptionDescription copied from class:AbstractModelWriterWrites a singledoubleto the underlyingDataOutputStream.- Specified by:
writeDoublein classAbstractModelWriter- Parameters:
d- Thedoublevalue.- Throws:
IOException- Thrown if IO errors occurred.
-
close
public void close() throws IOExceptionDescription copied from class:AbstractModelWriterCloses the underlyingDataOutputStream.- Specified by:
closein classAbstractModelWriter- Throws:
IOException- Thrown if IO errors occurred.
-
-