pitt.search.semanticvectors
Class VectorStoreRAM
java.lang.Object
pitt.search.semanticvectors.VectorStoreRAM
- All Implemented Interfaces:
- VectorStore
public class VectorStoreRAM
- extends java.lang.Object
- implements VectorStore
This class provides methods for reading a VectorStore into memory
as an optimization if batching many searches.
The serialization currently presumes that the object (in the ObjectVectors)
should be serialized as a String.
The class is constructed by creating a VectorStoreReader class,
iterating through vectors and reading them into memory.
- See Also:
VectorStoreReaderLucene
,
ObjectVector
Method Summary |
java.util.Enumeration |
getAllVectors()
|
int |
getNumVectors()
|
float[] |
getVector(java.lang.Object desiredObject)
Given an object, get its corresponding vector
This implementation only works for string objects so far
|
void |
InitFromFile(java.lang.String vectorFile)
|
void |
putVector(java.lang.Object key,
float[] vector)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
VectorStoreRAM
public VectorStoreRAM()
InitFromFile
public void InitFromFile(java.lang.String vectorFile)
throws java.io.IOException
- Throws:
java.io.IOException
putVector
public void putVector(java.lang.Object key,
float[] vector)
getAllVectors
public java.util.Enumeration getAllVectors()
- Specified by:
getAllVectors
in interface VectorStore
- Returns:
- an enumeration of all the object vectors in the store.
getNumVectors
public int getNumVectors()
- Specified by:
getNumVectors
in interface VectorStore
- Returns:
- a count of the number of vectors in the store.
getVector
public float[] getVector(java.lang.Object desiredObject)
- Given an object, get its corresponding vector
This implementation only works for string objects so far
- Specified by:
getVector
in interface VectorStore
- Parameters:
desiredObject
- - the string you're searching for
- Returns:
- vector from the VectorStore, or null if not found.