org.apache.mahout.vectorizer.collocations.llr
Class GramKey
java.lang.Object
org.apache.hadoop.io.BinaryComparable
org.apache.mahout.vectorizer.collocations.llr.GramKey
- All Implemented Interfaces:
- java.lang.Comparable<org.apache.hadoop.io.BinaryComparable>, org.apache.hadoop.io.Writable, org.apache.hadoop.io.WritableComparable<org.apache.hadoop.io.BinaryComparable>
public final class GramKey
- extends org.apache.hadoop.io.BinaryComparable
- implements org.apache.hadoop.io.WritableComparable<org.apache.hadoop.io.BinaryComparable>
A GramKey, based on the identity fields of Gram (type, string) plus a byte[] used for secondary ordering
Constructor Summary |
GramKey()
|
GramKey(Gram gram,
byte[] order)
create a GramKey based on the specified Gram and order |
Methods inherited from class org.apache.hadoop.io.BinaryComparable |
compareTo, compareTo, equals, hashCode |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.lang.Comparable |
compareTo |
GramKey
public GramKey()
GramKey
public GramKey(Gram gram,
byte[] order)
- create a GramKey based on the specified Gram and order
- Parameters:
gram
- order
-
set
public void set(Gram gram,
byte[] order)
- set the gram held by this key
getBytes
public byte[] getBytes()
- Specified by:
getBytes
in class org.apache.hadoop.io.BinaryComparable
getLength
public int getLength()
- Specified by:
getLength
in class org.apache.hadoop.io.BinaryComparable
getPrimaryLength
public int getPrimaryLength()
readFields
public void readFields(java.io.DataInput in)
throws java.io.IOException
- Specified by:
readFields
in interface org.apache.hadoop.io.Writable
- Throws:
java.io.IOException
write
public void write(java.io.DataOutput out)
throws java.io.IOException
- Specified by:
write
in interface org.apache.hadoop.io.Writable
- Throws:
java.io.IOException
getType
public Gram.Type getType()
- Returns:
- the gram is at the head of its text unit or tail or unigram.
getPrimaryString
public java.lang.String getPrimaryString()
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
Copyright © 2008-2010 The Apache Software Foundation. All Rights Reserved.