|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cc.mallet.types.Alphabet
public class Alphabet
A mapping between integers and objects where the mapping in each direction is efficient. Integers are assigned consecutively, starting at zero, as objects are added to the Alphabet. Objects can not be deleted from the Alphabet and thus the integers are never reused.
The most common use of an alphabet is as a dictionary of feature names
associated with a FeatureVector
in an
Instance
. In a simple document
classification usage,
each unique word in a document would be a unique entry in the Alphabet
with a unique integer associated with it. FeatureVectors rely on
the integer part of the mapping to efficiently represent the subset of
the Alphabet present in the FeatureVector.
FeatureVector
,
Instance
,
Pipe
,
Serialized FormConstructor Summary | |
---|---|
Alphabet()
|
|
Alphabet(java.lang.Class entryClass)
|
|
Alphabet(int capacity)
|
|
Alphabet(int capacity,
java.lang.Class entryClass)
|
|
Alphabet(java.lang.Object[] entries)
|
Method Summary | |
---|---|
static boolean |
alphabetsMatch(AlphabetCarrying object1,
AlphabetCarrying object2)
Convenience method that can often implement alphabetsMatch in classes that implement the AlphabetsCarrying interface. |
java.lang.Object |
clone()
|
boolean |
contains(java.lang.Object entry)
|
void |
dump()
|
void |
dump(java.io.PrintStream out)
|
void |
dump(java.io.PrintWriter out)
|
java.lang.Class |
entryClass()
|
java.rmi.dgc.VMID |
getInstanceId()
|
boolean |
growthStopped()
|
java.util.Iterator |
iterator()
|
int |
lookupIndex(java.lang.Object entry)
|
int |
lookupIndex(java.lang.Object entry,
boolean addIfNotPresent)
Return -1 if entry isn't present. |
int[] |
lookupIndices(java.lang.Object[] objects,
boolean addIfNotPresent)
|
java.lang.Object |
lookupObject(int index)
|
java.lang.Object[] |
lookupObjects(int[] indices)
|
java.lang.Object[] |
lookupObjects(int[] indices,
java.lang.Object[] buf)
Returns an array of the objects corresponding to |
java.lang.Object |
readResolve()
This gets called after readObject; it lets the object decide whether to return itself or return a previously read in version. |
void |
setInstanceId(java.rmi.dgc.VMID id)
|
int |
size()
|
void |
startGrowth()
|
void |
stopGrowth()
|
java.lang.Object[] |
toArray()
|
java.lang.Object[] |
toArray(java.lang.Object[] in)
Returns an array containing all the entries in the Alphabet. |
java.lang.String |
toString()
Return String representation of all Alphabet entries, each separated by a newline. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Alphabet(int capacity, java.lang.Class entryClass)
public Alphabet(java.lang.Class entryClass)
public Alphabet(int capacity)
public Alphabet()
public Alphabet(java.lang.Object[] entries)
Method Detail |
---|
public java.lang.Object clone()
clone
in class java.lang.Object
public int lookupIndex(java.lang.Object entry, boolean addIfNotPresent)
public int lookupIndex(java.lang.Object entry)
public java.lang.Object lookupObject(int index)
public java.lang.Object[] toArray()
public java.lang.Object[] toArray(java.lang.Object[] in)
public java.util.Iterator iterator()
public java.lang.Object[] lookupObjects(int[] indices)
public java.lang.Object[] lookupObjects(int[] indices, java.lang.Object[] buf)
indices
- An array of indices to look upbuf
- An array to store the returned objects in.
public int[] lookupIndices(java.lang.Object[] objects, boolean addIfNotPresent)
public boolean contains(java.lang.Object entry)
public int size()
public void stopGrowth()
public void startGrowth()
public boolean growthStopped()
public java.lang.Class entryClass()
public java.lang.String toString()
toString
in class java.lang.Object
public void dump()
public void dump(java.io.PrintStream out)
public void dump(java.io.PrintWriter out)
public static boolean alphabetsMatch(AlphabetCarrying object1, AlphabetCarrying object2)
public java.rmi.dgc.VMID getInstanceId()
public void setInstanceId(java.rmi.dgc.VMID id)
public java.lang.Object readResolve() throws java.io.ObjectStreamException
java.io.ObjectStreamException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |