public class SemanticSpaceIO extends Object
SemanticSpace
instances. For a full description of the supported formats, see the file
formats wiki page.
When loading a semantic space from a file, this class will automatically try to determine whether its data will fit into memory. If loading the space would exceed the available memory, the space is only partially loaded and its data stays on disk. This allows users to load several semantic spaces at once.
All of the SemanticSpace
instances return by this class are thread
safe. In addition they are all unmodifiable due to the limitations of
changing the backing data disk. Calls to processDocument
and processSpace
will result in an UnsupportedOperationException
being
thrown.
SemanticSpace
,
StaticSemanticSpace
,
OnDiskSemanticSpace
Modifier and Type | Class and Description |
---|---|
static class |
SemanticSpaceIO.SSpaceFormat
The type of formatting to use when writing a semantic space to a file.
|
Modifier and Type | Method and Description |
---|---|
static SemanticSpace |
load(File sspaceFile)
Loads and returns the
SemanticSpace stored in the specified
file. |
static SemanticSpace |
load(File sspaceFile,
SemanticSpaceIO.SSpaceFormat format)
Deprecated.
|
static SemanticSpace |
load(String sspaceFileName)
Loads and returns the
SemanticSpace from the file with the
specified name. |
static SemanticSpace |
load(String sspaceFileName,
SemanticSpaceIO.SSpaceFormat format)
Deprecated.
|
static void |
save(SemanticSpace sspace,
File output)
Writes the data contained in the
SemanticSpace to the provided
file using the SemanticSpaceIO.SSpaceFormat.TEXT format. |
static void |
save(SemanticSpace sspace,
File output,
SemanticSpaceIO.SSpaceFormat format)
Writes the data contained in the
SemanticSpace to the provided
file and format. |
static void |
save(SemanticSpace sspace,
String outputFileName)
Writes the data contained in the
SemanticSpace to the file with
the provided name using the SemanticSpaceIO.SSpaceFormat.TEXT format. |
public static SemanticSpace load(String sspaceFileName) throws IOException
SemanticSpace
from the file with the
specified name.sspaceFileName
- the name of a file containing a SemanticSpace
that has been written to diskIllegalArgumentException
- if the file does not contain an internal
format specificationIOException
- if any I/O exception occurs when reading the semantic
space data from the file@Deprecated public static SemanticSpace load(String sspaceFileName, SemanticSpaceIO.SSpaceFormat format) throws IOException
SemanticSpace
stored at the file in the
specified format.sspaceFileName
- the name of a file containing a SemanticSpace
that has been written to diskformat
- the format of the SemanticSpace
in the fileIOException
- if any I/O exception occurs when reading the semantic
space data from the filepublic static SemanticSpace load(File sspaceFile) throws IOException
SemanticSpace
stored in the specified
file.sspaceFile
- a file containing a SemanticSpace
that has
been written to diskIllegalArgumentException
- if the file does not contain an internal
format specificationIOException
- if any I/O exception occurs when reading the semantic
space data from the file@Deprecated public static SemanticSpace load(File sspaceFile, SemanticSpaceIO.SSpaceFormat format) throws IOException
SemanticSpace
stored at the file in the
specified format.sspaceFile
- a file containing a SemanticSpace
that has
been written to diskformat
- the format of the SemanticSpace
in the fileIOException
- if any I/O exception occurs when reading the semantic
space data from the filepublic static void save(SemanticSpace sspace, String outputFileName) throws IOException
SemanticSpace
to the file with
the provided name using the SemanticSpaceIO.SSpaceFormat.TEXT
format. See here for file format specifications.IOException
- if any I/O exception occurs when reading the semantic
space data from the filepublic static void save(SemanticSpace sspace, File output) throws IOException
SemanticSpace
to the provided
file using the SemanticSpaceIO.SSpaceFormat.TEXT
format. See here for file format specifications.IOException
- if any I/O exception occurs when reading the semantic
space data from the filepublic static void save(SemanticSpace sspace, File output, SemanticSpaceIO.SSpaceFormat format) throws IOException
SemanticSpace
to the provided
file and format. See here for file format
specifications.IOException
- if any I/O exception occurs when reading the semantic
space data from the fileCopyright © 2012. All Rights Reserved.