public class FileBasedTemporalSemanticSpace extends Object implements TemporalSemanticSpace
TemporalSemanticSpace
created from the serialized output of another
TemporalSemanticSpace
after it has finished processing. The input
format of the file should be one of the formats specified by TSSpaceFormat
.TemporalSemanticSpaceUtils
Constructor and Description |
---|
FileBasedTemporalSemanticSpace(File file)
Creates the
FileBasedTemporalSemanticSpace from the provided
file in the text format. |
FileBasedTemporalSemanticSpace(File file,
TemporalSemanticSpaceUtils.TSSpaceFormat format)
Creates the
FileBasedTemporalSemanticSpace from the provided
file in the specified format. |
FileBasedTemporalSemanticSpace(String filename)
Creates the
FileBasedTemporalSemanticSpace from the file using
the text format. |
FileBasedTemporalSemanticSpace(String filename,
TemporalSemanticSpaceUtils.TSSpaceFormat format)
Creates the
FileBasedTemporalSemanticSpace from the file in the
specified format. |
Modifier and Type | Method and Description |
---|---|
Long |
endTime()
Returns the time for the latest semantics contained within this space.
|
String |
getSpaceName()
Returns a unique string describing the name and configuration of this
algorithm.
|
SortedSet<Long> |
getTimeSteps(String word)
Returns the time steps in which the provided word occurs (optional
operation).
|
Vector |
getVector(String word)
Returns the provided word's semantic vector based on all temporal
occurrences.
|
Vector |
getVectorAfter(String word,
long startTime)
Returns the provided word's semantic vector based on all temporal
occurrences occurring on or after the provided timestamp (optional
operation).
|
Vector |
getVectorBefore(String word,
long endTime)
Returns the provided word's semantic vector based on all temporal
occurrences before the provided timestamp (optional operation).
|
Vector |
getVectorBetween(String word,
long start,
long endTime)
Returns the provided word's semantic vector based on all temporal
occurrences that happened on or after the start timestamp but before the
ending timestamp (optional operation).
|
int |
getVectorLength()
Returns the length of vectors in this semantic space.
|
Set<String> |
getWords()
Returns the set of words that are represented in this semantic space.
|
void |
processDocument(BufferedReader document)
A noop.
|
void |
processDocument(BufferedReader document,
long time)
A noop.
|
void |
processSpace(Properties props)
A noop.
|
Long |
startTime()
Returns the time for the earliest semantics contained within this space.
|
public FileBasedTemporalSemanticSpace(String filename)
FileBasedTemporalSemanticSpace
from the file using
the text
format.filename
- filename of the data intended be provided by this TemporalSemanticSpace
.public FileBasedTemporalSemanticSpace(File file)
FileBasedTemporalSemanticSpace
from the provided
file in the text
format.file
- a file containing the data intended be provided by this
TemporalSemanticSpace
.public FileBasedTemporalSemanticSpace(String filename, TemporalSemanticSpaceUtils.TSSpaceFormat format)
FileBasedTemporalSemanticSpace
from the file in the
specified format.filename
- the name of a file containing the data intended be
provided by this TemporalSemanticSpace
.public FileBasedTemporalSemanticSpace(File file, TemporalSemanticSpaceUtils.TSSpaceFormat format)
FileBasedTemporalSemanticSpace
from the provided
file in the specified format.file
- a file containing the data intended be provided by this
TemporalSemanticSpace
.public Long startTime()
startTime
in interface TemporalSemanticSpace
public Long endTime()
endTime
in interface TemporalSemanticSpace
public Vector getVector(String word)
getVector
in interface SemanticSpace
getVector
in interface TemporalSemanticSpace
word
- a word that may be in the semantic spaceVector
for the provided word or null
if the
word was not in the space.public Vector getVectorAfter(String word, long startTime)
getVectorAfter
in interface TemporalSemanticSpace
word
- a word in the semantic spacestartTime
- a UNIX timestamp that denotes the time after which all
occurrences of the provided word should be counted.null
if the word was not in the space.public Vector getVectorBefore(String word, long endTime)
getVectorBefore
in interface TemporalSemanticSpace
word
- a word in the semantic spaceendTime
- a UNIX timestamp that denotes the time before which all
occurrences of the provided would should be counted.null
if the word was not in the space.public Vector getVectorBetween(String word, long start, long endTime)
getVectorBetween
in interface TemporalSemanticSpace
word
- a word in the semantic spacestart
- a UNIX timestamp that denotes the time before which
no occurrences of the word should be counted.endTime
- a UNIX timestamp that denotes the time after which no
occurrences of the word should be counted.null
if the word was not in the space.public SortedSet<Long> getTimeSteps(String word)
getTimeSteps
in interface TemporalSemanticSpace
public Set<String> getWords()
getWords
in interface SemanticSpace
public String getSpaceName()
getSpaceName
in interface SemanticSpace
public int getVectorLength()
processSpace
is called.getVectorLength
in interface SemanticSpace
public void processDocument(BufferedReader document)
processDocument
in interface SemanticSpace
processDocument
in interface TemporalSemanticSpace
document
- a reader that allows access to the text of the documentpublic void processDocument(BufferedReader document, long time)
processDocument
in interface TemporalSemanticSpace
document
- a reader that allows access to the text of the documenttime
- the time at which the document was writtenpublic void processSpace(Properties props)
processSpace
in interface SemanticSpace
props
- a set of properties and values that may be used to
configure any exposed parameters of the algorithm.Copyright © 2012. All Rights Reserved.