public class Gram
extends org.apache.hadoop.io.BinaryComparable
implements org.apache.hadoop.io.WritableComparable<org.apache.hadoop.io.BinaryComparable>
Modifier and Type | Class and Description |
---|---|
static class |
Gram.Type |
Constructor and Description |
---|
Gram() |
Gram(Gram other)
Copy constructor
|
Gram(String ngram,
Gram.Type type)
Create an gram with a frequency of 1
|
Gram(String ngram,
int frequency,
Gram.Type type)
Create a gram with the specified frequency.
|
Modifier and Type | Method and Description |
---|---|
static Gram.Type |
decodeType(byte[] buf,
int offset) |
static void |
encodeType(Gram.Type type,
byte[] buf,
int offset) |
byte[] |
getBytes() |
int |
getFrequency() |
int |
getLength() |
String |
getString() |
Gram.Type |
getType() |
void |
incrementFrequency(int i) |
void |
readFields(DataInput in) |
void |
setFrequency(int frequency) |
String |
toString() |
void |
write(DataOutput out) |
compareTo, compareTo, equals, hashCode
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
compareTo
public Gram()
public Gram(Gram other)
public Gram(String ngram, Gram.Type type)
ngram
- the gram stringtype
- whether the gram is at the head or tail of its text unit or it is a unigrampublic byte[] getBytes()
getBytes
in class org.apache.hadoop.io.BinaryComparable
public int getLength()
getLength
in class org.apache.hadoop.io.BinaryComparable
public Gram.Type getType()
public String getString()
public int getFrequency()
public void setFrequency(int frequency)
frequency
- gram's frequencypublic void incrementFrequency(int i)
public void readFields(DataInput in) throws IOException
readFields
in interface org.apache.hadoop.io.Writable
IOException
public void write(DataOutput out) throws IOException
write
in interface org.apache.hadoop.io.Writable
IOException
public static void encodeType(Gram.Type type, byte[] buf, int offset)
public static Gram.Type decodeType(byte[] buf, int offset)
Copyright © 2008–2017 The Apache Software Foundation. All rights reserved.