de.pado.dv
Class SemanticSpaceHash

java.lang.Object
  extended by de.pado.dv.SemanticSpaceHash
All Implemented Interfaces:
SemanticSpace

public class SemanticSpaceHash
extends java.lang.Object
implements SemanticSpace

This is a naive hash-based implementation of the SemanticSpace interface. Since it only needs the space of filled cells, and since most semantic spaces are very sparse, this implementation usually saves much memory over the SemanticSpaceArray implementation. However, each access involves two hashmap operations; therefore, it is slower .


Method Summary
 boolean containsBE(java.lang.String b)
          Determines if the basis element b is used for representation in the semantic space.
 boolean containsTarget(java.lang.String t)
          Determines if the target t is represented in the semantic space.
 void increaseCount(java.lang.String target, java.lang.String be, double value)
          Increases the co-occurrence count for a given target and basis element combination.
 java.lang.String toString()
          Returns a string representation of the semantic space.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

increaseCount

public void increaseCount(java.lang.String target,
                          java.lang.String be,
                          double value)
Increases the co-occurrence count for a given target and basis element combination.

Specified by:
increaseCount in interface SemanticSpace

containsTarget

public boolean containsTarget(java.lang.String t)
Determines if the target t is represented in the semantic space.

Specified by:
containsTarget in interface SemanticSpace

containsBE

public boolean containsBE(java.lang.String b)
Description copied from interface: SemanticSpace
Determines if the basis element b is used for representation in the semantic space.

Specified by:
containsBE in interface SemanticSpace

toString

public java.lang.String toString()
Returns a string representation of the semantic space. The representation follows the format specified for SemanticSpaceArray: The format follows the old McDonald file format. First line: list of basis elements (tab-separated). All following lines contain first a target, then a colon, and then space-separated double values. Both targets and basis elements are ordered naturally (lexicographically). Notice that the resulting string object can become quite large due to the representation of floating point values by up to 16 characters each. It should probably be possible (but is not implemented) to specify the number of decimal places.

Specified by:
toString in interface SemanticSpace
Overrides:
toString in class java.lang.Object