public class SemanticSpaceWriter extends Object
SemanticSpace
incrementally, one vector
at a time. This class is designed for algorithms that need to write SemanticSpace
instances that are too large to fit into memory but can still
be computed.
Upon writing the last vector, users of this class must call #close() close
to ensure that the file header is correctly written.
SemanticSpaceIO
Constructor and Description |
---|
SemanticSpaceWriter(File sspaceFile,
SemanticSpaceIO.SSpaceFormat format)
Creates a
SemanticSpaceWriter that will write a SemanticSpace to the provided file in the specified format. |
Modifier and Type | Method and Description |
---|---|
void |
close()
Finishes writing the
SemanticSpace and writes all the associated
meta data. |
File |
getFile()
Returns the file containing the
SemanticSpace |
void |
write(String word,
Vector vector)
Writes the provided word and vector to the
SemanticSpace on disk. |
public SemanticSpaceWriter(File sspaceFile, SemanticSpaceIO.SSpaceFormat format)
SemanticSpaceWriter
that will write a SemanticSpace
to the provided file in the specified format.sspaceFile
- the file to which the SemanticSpace
will be
writtenformat
- the format of the semantic spacepublic void close() throws IOException
SemanticSpace
and writes all the associated
meta data. Once this method has been called, the backing file is valid
to read using SemanticSpaceIO
.IOException
public File getFile()
SemanticSpace
public void write(String word, Vector vector) throws IOException
SemanticSpace
on disk.IOException
Copyright © 2012. All Rights Reserved.