public class Bag<T>
extends java.lang.Object
Constructor and Description |
---|
Bag(T[] features)
Constructor.
|
Bag(T[] features,
boolean binary)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
double[] |
feature(T[] x)
Returns the bag-of-words features of a document.
|
public Bag(T[] features)
features
- the list of feature objects.public Bag(T[] features, boolean binary)
features
- the list of feature objects. The feature objects should be unique in the list.
Note that the Bag class doesn't learn the features, but just use them as attributes.binary
- true to check if feature object appear in a collection
instead of their frequencies.public double[] feature(T[] x)