pitt.search.semanticvectors
Class VectorStoreSparseRAM

java.lang.Object
  extended by pitt.search.semanticvectors.VectorStoreSparseRAM
All Implemented Interfaces:
VectorStore

public class VectorStoreSparseRAM
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

Nested Class Summary
 class VectorStoreSparseRAM.SparseVectorEnumeration
          Implements the hasMoreElements() and nextElement() methods to give Enumeration interface from sparse vector store.
 
Constructor Summary
VectorStoreSparseRAM()
           
 
Method Summary
 void CreateRandomVectors(int numVectors, int seedLength)
           
 java.util.Enumeration<ObjectVector> getAllVectors()
           
 java.util.Enumeration getKeys()
           
 int getNumVectors()
           
 short[] getSparseVector(java.lang.Object desiredObject)
          Returns the sparse vector without going through the float[] interface.
 float[] getVector(java.lang.Object desiredObject)
          Given an object, get its corresponding vector
This implementation only works for string objects so far
 void putVector(java.lang.String key, short[] sparseVector)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VectorStoreSparseRAM

public VectorStoreSparseRAM()
Method Detail

getKeys

public java.util.Enumeration getKeys()

CreateRandomVectors

public void CreateRandomVectors(int numVectors,
                                int seedLength)

putVector

public void putVector(java.lang.String key,
                      short[] sparseVector)

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.

getSparseVector

public short[] getSparseVector(java.lang.Object desiredObject)
Returns the sparse vector without going through the float[] interface.


getNumVectors

public int getNumVectors()
Specified by:
getNumVectors in interface VectorStore
Returns:
a count of the number of vectors in the store.

getAllVectors

public java.util.Enumeration<ObjectVector> getAllVectors()
Specified by:
getAllVectors in interface VectorStore
Returns:
an enumeration of all the object vectors in the store.