public class RandomIndexingDependencyContextGenerator extends Object implements DependencyContextGenerator
DependencyContextGenerator that forms context vectors using a
summation of index vectors. Each index vector is fixed TernaryVector
corresponding to each term in the corpus. Only index vectors for terms
reachable by a valid DependencyPath starting from the focus wordwill
be applied to a particular context.| Constructor and Description |
|---|
RandomIndexingDependencyContextGenerator(DependencyPermutationFunction<TernaryVector> permFunc,
DependencyPathAcceptor acceptor,
Map<String,TernaryVector> indexMap,
int indexVectorLength,
int pathLength)
Creates a new
RandomIndexingDependencyContextGenerator. |
| Modifier and Type | Method and Description |
|---|---|
SparseDoubleVector |
generateContext(DependencyTreeNode[] tree,
int focusIndex)
Returns a
SparseDoubleVector that represents the context composed
of the set of prevWords before the focus word and the set of
nextWords after the focus word. |
int |
getVectorLength()
Returns the maximum number of dimensions used to represent any given
context.
|
void |
setReadOnly(boolean readOnly)
Sets the read only mode of the
ContextGenerator. |
public RandomIndexingDependencyContextGenerator(DependencyPermutationFunction<TernaryVector> permFunc, DependencyPathAcceptor acceptor, Map<String,TernaryVector> indexMap, int indexVectorLength, int pathLength)
RandomIndexingDependencyContextGenerator.permFunc - the DependencyPermutationFunction responsible for
permuting TernaryVector, which serve as index vectors.acceptor - The DependencyPathAcceptor used to validate
DependencyPaths stemming from focus word.indexMap - A mapping from word forms to TernaryVectors.indexVectorLength - The length of each index vector.pathLength - The maximum acceptable length of any DependencyPath.public SparseDoubleVector generateContext(DependencyTreeNode[] tree, int focusIndex)
SparseDoubleVector that represents the context composed
of the set of prevWords before the focus word and the set of
nextWords after the focus word. Since sparse vectors are
returned, if a second order vector is generated, it is recommended that
the vector also be sparsed or have very few dimensions.generateContext in interface DependencyContextGeneratorpublic int getVectorLength()
getVectorLength in interface DependencyContextGeneratorpublic void setReadOnly(boolean readOnly)
ContextGenerator. When set to
read only, it prevents any new features from being generated.setReadOnly in interface DependencyContextGeneratorCopyright © 2012. All Rights Reserved.