mirror of https://github.com/apache/lucene.git
Adding a getter to FeatureField to allow value access (#13111)
Getting the access of a FeatureField#value is useful for deduplicating. If you have a sparse vector model and you want to handle multiple inputs from them, you want flexibility in how you de-duplicate the feature dimensions.
This commit is contained in:
parent
af0d0edf5e
commit
39f681812b
|
@ -166,6 +166,16 @@ public final class FeatureField extends Field {
|
|||
return stream;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is useful if you have multiple features sharing a name and you want to take action to
|
||||
* deduplicate them.
|
||||
*
|
||||
* @return the feature value of this field.
|
||||
*/
|
||||
public float getFeatureValue() {
|
||||
return featureValue;
|
||||
}
|
||||
|
||||
private static final class FeatureTokenStream extends TokenStream {
|
||||
private final CharTermAttribute termAttribute = addAttribute(CharTermAttribute.class);
|
||||
private final TermFrequencyAttribute freqAttribute = addAttribute(TermFrequencyAttribute.class);
|
||||
|
|
Loading…
Reference in New Issue