moj.ri.weighting
Class WeightingScheme
java.lang.Object
moj.ri.weighting.WeightingScheme
- All Implemented Interfaces:
- java.io.Serializable
- Direct Known Subclasses:
- ConstantWS, MangesWS, MartinsWS, RosellsWS
public abstract class WeightingScheme
- extends java.lang.Object
- implements java.io.Serializable
Calculates the weighting of the context label.
All subclasses of WeightingScheme
must provide methods
for calculating the weights for left and right context windows according
to the desired algorithm (for example using distance to context label).
If there is a need to be able to serialize the RandomIndex
, all
subclasses of WeightingScheme
must declare their own
serialVersionUID
.
- Version:
- 2005-Apr-04
- Author:
- Martin Hassel
- See Also:
- Serialized Form
Method Summary |
abstract float[] |
applyLeftWeighting(RandomLabel focusLabel,
int distance,
RandomLabel leftContextLabel)
Adds the weighted context label (in the left context) to the focus label's
context label and returns it. |
abstract float[] |
applyRightWeighting(RandomLabel focusLabel,
int distance,
RandomLabel rightContextLabel)
Adds the weighted context label (in the right context) to the focus label's
context label and returns it. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
WeightingScheme
public WeightingScheme()
applyLeftWeighting
public abstract float[] applyLeftWeighting(RandomLabel focusLabel,
int distance,
RandomLabel leftContextLabel)
- Adds the weighted context label (in the left context) to the focus label's
context label and returns it.
Application writers must its own methods in a subclass to calculate
the weights according to specific algorithms.
- Parameters:
focusLabel
- RandomLabel in focus, i.e. the focus word whose context vector
should be modified with the weighted RandomLabel in left context.distance
- leftward distance to the focus word (RandomLabel).leftContextLabel
- RandomLabel in left context at distance
from
the focus word, which can be used together with distance
to
calculate the weight.
- Returns:
- the context of the focus word modified according to the weighting scheme.
applyRightWeighting
public abstract float[] applyRightWeighting(RandomLabel focusLabel,
int distance,
RandomLabel rightContextLabel)
- Adds the weighted context label (in the right context) to the focus label's
context label and returns it.
Application writers must its own methods in a subclass to calculate
the weights according to specific algorithms.
- Parameters:
focusLabel
- RandomLabel in focus, i.e. the focus word whose context vector
should be modified with the weighted RandomLabel in right context.distance
- rightward distance to the focus word (RandomLabel).rightContextLabel
- RandomLabel in right context at distance
from
the focus word, which can be used together with distance
to
calculate the weight.
- Returns:
- the context of the focus word modified according to the weighting scheme.