moj.ri.weighting
Class MartinsWS
java.lang.Object
moj.ri.weighting.WeightingScheme
moj.ri.weighting.MartinsWS
- All Implemented Interfaces:
- java.io.Serializable
public class MartinsWS
- extends WeightingScheme
Calculates the weighting based upon the distance to the current label in
the following manner: weight=(1/distance to focus word)
but also gives a higher weight to content words. The index term
(word
) should be in the form word_pos for this
WeightingScheme to work properly.
- Version:
- 2004-Nov-23
- Author:
- Martin Hassel
- See Also:
- Serialized Form
Method Summary |
float[] |
applyLeftWeighting(RandomLabel focusLabel,
int distance,
RandomLabel leftContextLabel)
Calculates the weight based upon the distance (in the left context) to
the current label in the following manner: weight=(1/distance to focus word) |
float[] |
applyRightWeighting(RandomLabel focusLabel,
int distance,
RandomLabel rightContextLabel)
Calculates the weight based upon the distance (in the right context) to
the current label in the following manner: weight=(1/distance to focus word) |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MartinsWS
public MartinsWS()
applyLeftWeighting
public float[] applyLeftWeighting(RandomLabel focusLabel,
int distance,
RandomLabel leftContextLabel)
- Calculates the weight based upon the distance (in the left context) to
the current label in the following manner: weight=(1/distance to focus word)
- Specified by:
applyLeftWeighting
in class WeightingScheme
- 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 float[] applyRightWeighting(RandomLabel focusLabel,
int distance,
RandomLabel rightContextLabel)
- Calculates the weight based upon the distance (in the right context) to
the current label in the following manner: weight=(1/distance to focus word)
- Specified by:
applyRightWeighting
in class WeightingScheme
- 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.