/**
* {@inheritDoc}
*/
public SparseDoubleVector generateContext(DependencyTreeNode[] tree,
int focusIndex) {
Iterator<DependencyPath> paths = new FilteredDependencyIterator(
tree[focusIndex], acceptor, 1);
// Get the first contextualized meaning. Return any empty vector in
// case we don't have any paths for the word of interest (this should
// never happen).
if (!paths.hasNext())
return new CompactSparseVector();
SparseDoubleVector focusMeaning = contextualize(paths.next());
// If this focus word isn't connected to any other word, just return the
// contextualized vector that we have.
if (!paths.hasNext())
return focusMeaning;
SparseDoubleVector secondMeaning = contextualize(paths.next());
// If we have two relations for the focus word, multiply each
// contextualized vector from the relations and return that as the final
// meaning.
return VectorMath.multiplyUnmodified(focusMeaning, secondMeaning);