public class FeatureSequence extends Object implements Sequence, Serializable
Sequence that ensures that every
Object in the sequence has the same class. Feature sequences are
mutable, and will expand as new objects are added.| Constructor and Description |
|---|
FeatureSequence(Alphabet dict) |
FeatureSequence(Alphabet dict,
int capacity) |
FeatureSequence(Alphabet dict,
int[] features)
Creates a FeatureSequence given all of the objects in the
sequence.
|
FeatureSequence(Alphabet dict,
int[] features,
int len) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(int featureIndex) |
void |
add(Object key) |
void |
addFeatureWeightsTo(double[] weights) |
void |
addFeatureWeightsTo(double[] weights,
double scale) |
Object |
get(int pos) |
Alphabet |
getAlphabet() |
int |
getIndexAtPosition(int pos) |
int |
getLength() |
Object |
getObjectAtPosition(int pos) |
protected void |
growIfNecessary() |
int |
size() |
int[] |
toFeatureIndexSequence() |
int[] |
toSortedFeatureIndexSequence() |
String |
toString() |
public FeatureSequence(Alphabet dict, int[] features)
dict - A dictionary that maps objects in the sequence
to numeric indices.features - An array where features[i] gives the index
in dict of the ith element of the sequence.public FeatureSequence(Alphabet dict, int[] features, int len)
public FeatureSequence(Alphabet dict, int capacity)
public FeatureSequence(Alphabet dict)
public Alphabet getAlphabet()
public final int getLength()
public final int getIndexAtPosition(int pos)
public Object getObjectAtPosition(int pos)
protected void growIfNecessary()
public void add(int featureIndex)
public void add(Object key)
public void addFeatureWeightsTo(double[] weights)
public void addFeatureWeightsTo(double[] weights,
double scale)
public int[] toFeatureIndexSequence()
public int[] toSortedFeatureIndexSequence()
Copyright © 2019 JULIE Lab, Germany. All rights reserved.