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)
WordOccrrenceDependencyContextGeneratorbasisMapping - A mapping from word forms to their feature indicesweighter - A weight function applied to each DependencyPathacceptor - An acceptor that rejects invalid DependencyPathpathLength - The maximum length for a valid DependencyPathpublic 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.