Package opennlp.tools.ml.naivebayes
Class BinaryNaiveBayesModelWriter
java.lang.Object
opennlp.tools.ml.model.AbstractModelWriter
opennlp.tools.ml.AbstractMLModelWriter
opennlp.tools.ml.naivebayes.NaiveBayesModelWriter
opennlp.tools.ml.naivebayes.BinaryNaiveBayesModelWriter
A
NaiveBayesModelWriter that writes models in a binary format.-
Constructor Summary
ConstructorsConstructorDescriptionBinaryNaiveBayesModelWriter(AbstractModel model, DataOutputStream dos) BinaryNaiveBayesModelWriter(AbstractModel model, File f) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the underlyingDataOutputStream.voidwriteDouble(double d) Writes a singledoubleto the underlyingDataOutputStream.voidwriteInt(int i) Writes a singleintto the underlyingDataOutputStream.voidWrites aStringto the underlyingDataOutputStream.Methods inherited from class opennlp.tools.ml.naivebayes.NaiveBayesModelWriter
persist
-
Constructor Details
-
BinaryNaiveBayesModelWriter
InstantiatesBinaryNaiveBayesModelWritervia 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:
-
BinaryNaiveBayesModelWriter
- Parameters:
model- Thenaive bayes modelwhich is to be persisted.dos- TheDataOutputStreamwhich is used to persist themodel. Thedosmust be opened.
-
-
Method Details
-
writeUTF
Description copied from class:AbstractModelWriterWrites aStringto the underlyingDataOutputStream.- Specified by:
writeUTFin classAbstractModelWriter- Parameters:
s- TheUTF encodedcharacters.- Throws:
IOException- Thrown if IO errors occurred.
-
writeInt
Description copied from class:AbstractModelWriterWrites a singleintto the underlyingDataOutputStream.- Specified by:
writeIntin classAbstractModelWriter- Parameters:
i- Theintvalue.- Throws:
IOException- Thrown if IO errors occurred.
-
writeDouble
Description copied from class:AbstractModelWriterWrites a singledoubleto the underlyingDataOutputStream.- Specified by:
writeDoublein classAbstractModelWriter- Parameters:
d- Thedoublevalue.- Throws:
IOException- Thrown if IO errors occurred.
-
close
Description copied from class:AbstractModelWriterCloses the underlyingDataOutputStream.- Specified by:
closein classAbstractModelWriter- Throws:
IOException- Thrown if IO errors occurred.
-