public class NGramEstimator extends Object
Constructor and Description |
---|
NGramEstimator()
Creates a new n-gram estimator object.
|
Modifier and Type | Method and Description |
---|---|
void |
add(ArrayList<String> ng)
Adds a new n-gram to the estimation.
|
ArrayList<Object[]> |
getNGrams()
Returns the final top-k n-grams in a format suitable for returning to Hive.
|
void |
initialize(int pk,
int ppf,
int pn)
Sets the 'k' and 'pf' parameters.
|
boolean |
isInitialized()
Returns true if the 'k' and 'pf' parameters have been set.
|
void |
merge(List other)
Takes a serialized n-gram estimator object created by the serialize() method and merges
it with the current n-gram object.
|
void |
reset()
Resets an n-gram estimator object to its initial state.
|
ArrayList<org.apache.hadoop.io.Text> |
serialize()
In preparation for a Hive merge() call, serializes the current n-gram estimator object into an
ArrayList of Text objects.
|
int |
size()
Returns the number of n-grams in our buffer.
|
public NGramEstimator()
public boolean isInitialized()
public void initialize(int pk, int ppf, int pn) throws HiveException
HiveException
public void reset()
public ArrayList<Object[]> getNGrams() throws HiveException
HiveException
public int size()
public void add(ArrayList<String> ng) throws HiveException
ng
- The n-gram to add to the estimationHiveException
public void merge(List other) throws HiveException
other
- A serialized n-gram object created by the serialize() methodHiveException
public ArrayList<org.apache.hadoop.io.Text> serialize() throws HiveException
HiveException
merge(java.util.List)
Copyright © 2017 The Apache Software Foundation. All rights reserved.