public class Bag
extends java.lang.Object
Constructor and Description |
---|
Bag(java.lang.String[] words)
Constructor.
|
Bag(java.lang.String[] words,
boolean binary)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int[] |
apply(java.lang.String[] x)
Returns the bag-of-words features of a document.
|
public Bag(java.lang.String[] words)
words
- the list of feature words.public Bag(java.lang.String[] words, boolean binary)
words
- the list of feature words. The feature words 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.