public class WordOccrrenceDependencyContextGenerator extends Object implements DependencyContextGenerator
DependencyContextGenerator
that forms co-occurrence context vectors
from words that are reachable via a valid DependencyPath
from a focus
term.Constructor and Description |
---|
WordOccrrenceDependencyContextGenerator(DependencyPathBasisMapping basisMapping,
DependencyPathWeight weighter,
DependencyPathAcceptor acceptor,
int pathLength)
Creates a new
WordOccrrenceDependencyContextGenerator |
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 WordOccrrenceDependencyContextGenerator(DependencyPathBasisMapping basisMapping, DependencyPathWeight weighter, DependencyPathAcceptor acceptor, int pathLength)
WordOccrrenceDependencyContextGenerator
basisMapping
- A mapping from word forms to their feature indicesweighter
- A weight function applied to each DependencyPath
acceptor
- An acceptor that rejects invalid DependencyPath
pathLength
- The maximum length for a valid 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 DependencyContextGenerator
public int getVectorLength()
getVectorLength
in interface DependencyContextGenerator
public void setReadOnly(boolean readOnly)
ContextGenerator
. When set to
read only, it prevents any new features from being generated.setReadOnly
in interface DependencyContextGenerator
Copyright © 2012. All Rights Reserved.