public class StringLengthFeatureExtractor extends Object implements FeatureExtractor<CharSequence>, Serializable
StringLengthFeatureExtractorimplements a feature extractor that provides string length features based on a specified set of string lengths.
Each specified length will become a feature with value 1.0 if
the string is greater than or equal to the specified length. For
example, if the specified lengths were
"ab" would produce feature map
A length of 0 will always produce the feature mapping
LEN>=0:1.0, which is redundant if there is an intercept in
(constant feature) in the relevant problem. If not, it is tantamount
to adding one. Note that intercept features added this way are
subject to priors and not treated separately like an intercept
always added as the first feature.
|Constructor and Description|
Construct a string-length feature extractor based on the specified lengths.
|Modifier and Type||Method and Description|
Return the feature vector for the specified input.
public StringLengthFeatureExtractor(int... lengths)
lengths- Array (or varargs) of lengths.
IllegalArgumentException- If there is not at least one length or if any of the lengths are less than zero.
public Map<String,? extends Number> features(CharSequence in)